Skip to content

Commit 2687fe9

Browse files
authored
Merge pull request #31 from dreamvo/feat/versionCmd
Create version command
2 parents 755e5dc + 38ede29 commit 2687fe9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cmd/version.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"github.com/dreamvo/gilfoyle/config"
6+
"github.com/spf13/cobra"
7+
)
8+
9+
func init() {
10+
// Register command
11+
rootCmd.AddCommand(versionCmd)
12+
}
13+
14+
var versionCmd = &cobra.Command{
15+
Use: "version",
16+
Short: "Print program version",
17+
Run: func(cmd *cobra.Command, args []string) {
18+
fmt.Printf("Gilfoyle version %s commit %s\n", config.Version, config.Commit)
19+
},
20+
}

0 commit comments

Comments
 (0)