Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
add version command
Browse files Browse the repository at this point in the history
  • Loading branch information
ingbyr committed Dec 27, 2021
1 parent 403f10f commit 9409135
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var rootCmd = &cobra.Command{
}

func Execute() {
rootCmd.AddCommand(versionCmd)
rootCmd.AddCommand(listCmd)
rootCmd.AddCommand(editCmd)
rootCmd.AddCommand(useCmd)
Expand Down
17 changes: 17 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"fmt"
"github.com/ingbyr/gohost/conf"
"github.com/spf13/cobra"
)

var (
versionCmd = &cobra.Command{
Use: "version",
Short: "display version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version %s\n", conf.Version)
},
}
)
1 change: 1 addition & 0 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

const (
Version = "0.1.1"
SepGroupInFile = "_"
SepInCmd = ","

Expand Down

0 comments on commit 9409135

Please sign in to comment.