From 7d58f82f1bdbe00f37dc678b8da15510506d9d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Fabianski?= Date: Mon, 6 Nov 2023 12:00:59 +0100 Subject: [PATCH 1/2] chore(cli): set version for root --- internal/commands/app.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/commands/app.go b/internal/commands/app.go index 0e47938dd..975991833 100644 --- a/internal/commands/app.go +++ b/internal/commands/app.go @@ -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" @@ -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@%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 } From 6e3c65cfed45b6d0c822a06e51fe6124d90ccf07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Fabianski?= Date: Mon, 6 Nov 2023 14:55:02 +0100 Subject: [PATCH 2/2] chore(cli): consistent version --- e2e/flags/.snapshots/TestMetadataFlags-version | 3 +-- internal/commands/app.go | 2 +- internal/commands/version.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/e2e/flags/.snapshots/TestMetadataFlags-version b/e2e/flags/.snapshots/TestMetadataFlags-version index 997f1f85f..c0302bcd2 100644 --- a/e2e/flags/.snapshots/TestMetadataFlags-version +++ b/e2e/flags/.snapshots/TestMetadataFlags-version @@ -1,5 +1,4 @@ -- -bearer version: dev -sha: devSHA +bearer version dev, build devSHA diff --git a/internal/commands/app.go b/internal/commands/app.go index 975991833..ceb235ec4 100644 --- a/internal/commands/app.go +++ b/internal/commands/app.go @@ -66,7 +66,7 @@ Learn More: For more examples, tutorials, and to learn more about the project visit https://docs.bearer.com ` - version := fmt.Sprintf("%s@%s", build.Version, build.CommitSHA) + version := fmt.Sprintf("%s, build %s", build.Version, build.CommitSHA) cmd := &cobra.Command{ Use: "bearer", Args: cobra.NoArgs, diff --git a/internal/commands/version.go b/internal/commands/version.go index 8760f4b77..50eb65b29 100644 --- a/internal/commands/version.go +++ b/internal/commands/version.go @@ -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 }, }