mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
version
This commit is contained in:
5
cli/Makefile
Normal file
5
cli/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build
|
||||||
|
mv cli ipfs
|
@ -34,7 +34,7 @@ Use "ipfs help <command>" for more information about a command.
|
|||||||
`,
|
`,
|
||||||
Run: ipfsCmd,
|
Run: ipfsCmd,
|
||||||
Subcommands: []*commander.Command{
|
Subcommands: []*commander.Command{
|
||||||
// cmdIpfsVersion,
|
cmdIpfsVersion,
|
||||||
// cmdIpfsConfig,
|
// cmdIpfsConfig,
|
||||||
cmdIpfsCommands,
|
cmdIpfsCommands,
|
||||||
},
|
},
|
||||||
|
31
cli/version.go
Normal file
31
cli/version.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jbenet/commander"
|
||||||
|
u "github.com/jbenet/go-ipfs/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
const Version = "0.1.0"
|
||||||
|
|
||||||
|
var cmdIpfsVersion = &commander.Command{
|
||||||
|
UsageLine: "version",
|
||||||
|
Short: "Show ipfs version information.",
|
||||||
|
Long: `ipfs version - Show ipfs version information.
|
||||||
|
|
||||||
|
Returns the current version of ipfs and exits.
|
||||||
|
`,
|
||||||
|
Run: versionCmd,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
cmdIpfsVersion.Flag.Bool("number", false, "show only the number")
|
||||||
|
}
|
||||||
|
|
||||||
|
func versionCmd(c *commander.Command, _ []string) error {
|
||||||
|
number := c.Flag.Lookup("number").Value.Get().(bool)
|
||||||
|
if !number {
|
||||||
|
u.POut("ipfs version ")
|
||||||
|
}
|
||||||
|
u.POut("%s\n", Version)
|
||||||
|
return nil
|
||||||
|
}
|
Reference in New Issue
Block a user