Skip to content

Commit

Permalink
feat: Added version command (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItayLevyOfficial authored Jun 6, 2023
1 parent 8171c61 commit c406eb7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"

"github.com/dymensionxyz/roller/cmd/config"
"github.com/dymensionxyz/roller/cmd/version"
"github.com/spf13/cobra"
)

Expand All @@ -26,4 +27,5 @@ func Execute() {

func init() {
rootCmd.AddCommand(config.ConfigCmd())
rootCmd.AddCommand(version.VersionCmd())
}
26 changes: 26 additions & 0 deletions cmd/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package version

import (
"fmt"

"github.com/spf13/cobra"
)

var (
BuildVersion = "<version>"
BuildTime = "<build-time>"
BuildCommit = "<build-commit>"
)

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
}

0 comments on commit c406eb7

Please sign in to comment.