@cryptotaxi247 / kubo / commits / 0ab4a49ac

version

Juan Batiz-Benet committed Jul 5, 2014 at 02:05 UTC 0ab4a49acb668b4391ea5e10a6aec2a24a31a30b
3 files changed +37 -1
cli/Makefile new
+5
@@ -0,0 +1,5 @@
1 +all: build
2 +
3 +build:
4 + go build
5 + mv cli ipfs
cli/commands.go
+1 -1
@@ -34,7 +34,7 @@ Use "ipfs help <command>" for more information about a command.
34 `,
35 Run: ipfsCmd,
36 Subcommands: []*commander.Command{
37 - // cmdIpfsVersion,
37 + cmdIpfsVersion,
38 // cmdIpfsConfig,
39 cmdIpfsCommands,
40 },
cli/version.go new
+31
@@ -0,0 +1,31 @@
1 +package main
2 +
3 +import (
4 + "github.com/jbenet/commander"
5 + u "github.com/jbenet/go-ipfs/util"
6 +)
7 +
8 +const Version = "0.1.0"
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", Version)
30 + return nil
31 +}