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