Skip to content

Commit bd7ec42

Browse files
committed
Add version flag
1 parent 03d19d9 commit bd7ec42

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmd/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ var rootCmd = &cobra.Command{
1515
Long: `The CodeGame CLI helps you develop CodeGame applications.`,
1616
}
1717

18-
func Execute() {
18+
func Execute(version string) {
19+
rootCmd.SetVersionTemplate(`codegame-cli v{{.Version}}
20+
`)
21+
rootCmd.Version = version
1922
err := rootCmd.Execute()
2023
if err != nil {
2124
os.Exit(1)

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Version = "0.7.1"
2424

2525
func main() {
2626
checkVersion()
27-
cmd.Execute()
27+
cmd.Execute(Version)
2828
}
2929

3030
// checkVersion prints a warning, if there is a newer version of codegame-cli available.

0 commit comments

Comments
 (0)