From d8dd7704c1d6ec78e4f0946f0092d869ce8287fe Mon Sep 17 00:00:00 2001 From: Itay Levy Date: Tue, 6 Jun 2023 15:34:27 +0200 Subject: [PATCH 1/2] Implemented version command --- ...rideHomeDir.go => prompt_existing_root.go} | 0 cmd/root.go | 2 ++ cmd/version/version.go | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+) rename cmd/config/init/{overrideHomeDir.go => prompt_existing_root.go} (100%) create mode 100644 cmd/version/version.go diff --git a/cmd/config/init/overrideHomeDir.go b/cmd/config/init/prompt_existing_root.go similarity index 100% rename from cmd/config/init/overrideHomeDir.go rename to cmd/config/init/prompt_existing_root.go diff --git a/cmd/root.go b/cmd/root.go index f61c144e..538a0a20 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,6 +4,7 @@ import ( "os" "github.com/dymensionxyz/roller/cmd/config" + "github.com/dymensionxyz/roller/cmd/version" "github.com/spf13/cobra" ) @@ -26,4 +27,5 @@ func Execute() { func init() { rootCmd.AddCommand(config.ConfigCmd()) + rootCmd.AddCommand(version.VersionCmd()) } diff --git a/cmd/version/version.go b/cmd/version/version.go new file mode 100644 index 00000000..aaf744dc --- /dev/null +++ b/cmd/version/version.go @@ -0,0 +1,26 @@ +package version + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var ( + BuildVersion = "v0.0.0" + BuildTime = "2023-06-05T14:28:30Z" + BuildCommit = "fac8ada6eef7d846971274efea1127ab00909b03" +) + +func VersionCmd() *cobra.Command { + versionCmd := &cobra.Command{ + Use: "version", + Short: "Print the version of roller", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("💈 Roller version", BuildVersion) + fmt.Println("💈 Build time:", BuildTime) + fmt.Println("💈 Git commit:", BuildCommit) + }, + } + return versionCmd +} From 176552ca2d22f675776b7de9d7f8fac10dfe7a2f Mon Sep 17 00:00:00 2001 From: Itay Levy Date: Tue, 6 Jun 2023 15:54:56 +0200 Subject: [PATCH 2/2] Updated version values --- cmd/version/version.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/version/version.go b/cmd/version/version.go index aaf744dc..ed993b11 100644 --- a/cmd/version/version.go +++ b/cmd/version/version.go @@ -7,9 +7,9 @@ import ( ) var ( - BuildVersion = "v0.0.0" - BuildTime = "2023-06-05T14:28:30Z" - BuildCommit = "fac8ada6eef7d846971274efea1127ab00909b03" + BuildVersion = "" + BuildTime = "" + BuildCommit = "" ) func VersionCmd() *cobra.Command {