Skip to content

Commit c463b58

Browse files
authored
Merge pull request #85 from planetlabs/version
Restore version info
2 parents dd967c7 + b6564dd commit c463b58

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

.goreleaser.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ brews:
6060
description: "Utility for working with GeoParquet."
6161
license: "Apache-2.0"
6262
test: |
63-
system "#{bin}/xyz2ogc version"
63+
system "#{bin}/gpq version"

cmd/gpq/command/version.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ package command
1616

1717
import "fmt"
1818

19-
var (
20-
version = "dev"
21-
commit = "none"
22-
date = "unknown"
23-
)
24-
2519
type VersionCmd struct {
2620
Detail bool `help:"Include detail about the commit and build date."`
2721
}
2822

29-
func (c *VersionCmd) Run() error {
30-
output := version
23+
type VersionInfo struct {
24+
Version string
25+
Commit string
26+
Date string
27+
}
28+
29+
func (c *VersionCmd) Run(info *VersionInfo) error {
30+
output := info.Version
3131
if c.Detail {
32-
output = fmt.Sprintf("%s (%s %s)", output, commit, date)
32+
output = fmt.Sprintf("%s (%s %s)", output, info.Commit, info.Date)
3333
}
3434
fmt.Println(output)
3535
return nil

cmd/gpq/main.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ import (
1919
"github.com/planetlabs/gpq/cmd/gpq/command"
2020
)
2121

22+
var (
23+
version = "dev"
24+
commit = "none"
25+
date = "unknown"
26+
)
27+
2228
func main() {
2329
ctx := kong.Parse(&command.CLI)
24-
err := ctx.Run(ctx)
30+
err := ctx.Run(ctx, &command.VersionInfo{Version: version, Commit: commit, Date: date})
2531
ctx.FatalIfErrorf(err)
2632
}

0 commit comments

Comments
 (0)