github.com/zignig/go-ipfs@v0.0.0-20141111235910-c9e5fdf55a52/cmd/ipfs/version.go (about) 1 package main 2 3 import ( 4 config "github.com/jbenet/go-ipfs/config" 5 u "github.com/jbenet/go-ipfs/util" 6 7 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander" 8 ) 9 10 var cmdIpfsVersion = &commander.Command{ 11 UsageLine: "version", 12 Short: "Show ipfs version information.", 13 Long: `ipfs version - Show ipfs version information. 14 15 Returns the current version of ipfs and exits. 16 `, 17 Run: versionCmd, 18 } 19 20 func init() { 21 cmdIpfsVersion.Flag.Bool("number", false, "show only the number") 22 } 23 24 func versionCmd(c *commander.Command, _ []string) error { 25 number := c.Flag.Lookup("number").Value.Get().(bool) 26 if !number { 27 u.POut("ipfs version ") 28 } 29 u.POut("%s\n", config.CurrentVersionNumber) 30 return nil 31 }