Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): set version for root #1376

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading