Skip to content

Commit

Permalink
chore(cli): set version for root (#1376)
Browse files Browse the repository at this point in the history
* chore(cli): set version for root

* chore(cli): consistent version
  • Loading branch information
cfabianski authored Nov 6, 2023
1 parent 7483fc3 commit 672abc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions e2e/flags/.snapshots/TestMetadataFlags-version
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

--
bearer version: dev
sha: devSHA
bearer version dev, build devSHA

9 changes: 6 additions & 3 deletions internal/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package commands
import (
"fmt"

"github.com/bearer/bearer/cmd/bearer/build"
"github.com/bearer/bearer/internal/commands/artifact"
"github.com/bearer/bearer/internal/flag"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -65,12 +66,14 @@ Learn More:
For more examples, tutorials, and to learn more about the project
visit https://docs.bearer.com
`

version := fmt.Sprintf("%s, build %s", build.Version, build.CommitSHA)
cmd := &cobra.Command{
Use: "bearer",
Args: cobra.NoArgs,
Use: "bearer",
Args: cobra.NoArgs,
Version: version,
}
cmd.SetUsageTemplate(usageTemplate)

return cmd
}

Expand Down
2 changes: 1 addition & 1 deletion internal/commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewVersionCommand(version string, commitSHA string) *cobra.Command {
} else {
version_check.DisplayBinaryVersionWarning(meta, false)
}
cmd.Printf("bearer version: %s\nsha: %s\n", version, commitSHA)
cmd.Printf("bearer version %s, build %s\n", version, commitSHA)
return nil
},
}
Expand Down

0 comments on commit 672abc5

Please sign in to comment.