github.com/pengwynn/gh@v1.0.1-0.20140118055701-14327ca3942e/commands/version.go (about) 1 package commands 2 3 import ( 4 "fmt" 5 "github.com/jingweno/gh/git" 6 "github.com/jingweno/gh/utils" 7 "os" 8 ) 9 10 const Version = "1.0.0" 11 12 var cmdVersion = &Command{ 13 Run: runVersion, 14 Usage: "version", 15 Short: "Show gh version", 16 Long: `Shows git version and gh client version.`, 17 } 18 19 func init() { 20 CmdRunner.Use(cmdVersion) 21 } 22 23 func runVersion(cmd *Command, args *Args) { 24 gitVersion, err := git.Version() 25 utils.Check(err) 26 27 ghVersion := fmt.Sprintf("gh version %s", Version) 28 29 fmt.Println(gitVersion) 30 fmt.Println(ghVersion) 31 32 os.Exit(0) 33 }