diff --git a/.goreleaser.yml b/.goreleaser.yml index 0ca86f1..ad7bf37 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,6 +16,7 @@ builds: goarch: arm64 ldflags: - -s -w + - -X github.com/quantcli/liftoff-export-cli/cmd.version=v{{ .Version }} archives: - formats: diff --git a/cmd/root.go b/cmd/root.go index fc2eb54..f8adbdb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -7,9 +7,15 @@ import ( "github.com/spf13/cobra" ) +// version is overwritten at release time via +// -ldflags "-X github.com/quantcli/liftoff-export-cli/cmd.version=v1.2.0". +// Setting rootCmd.Version below makes cobra register --version for free. +var version = "dev" + var rootCmd = &cobra.Command{ - Use: "liftoff-export", - Short: "CLI for the Liftoff fitness app", + Use: "liftoff-export", + Short: "CLI for the Liftoff fitness app", + Version: version, Long: `liftoff-export reads your personal Liftoff (gymbros.com) workout and bodyweight data and prints it on stdout. Default output is narrow, fitdown-style markdown; pass --format json for the full structured row.