mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
parent
32d54a0afb
commit
f6f8d68574
@ -726,7 +726,11 @@ func YesNoPrompt(prompt string) bool {
|
||||
}
|
||||
|
||||
func printVersion() {
|
||||
fmt.Printf("go-ipfs version: %s-%s\n", version.CurrentVersionNumber, version.CurrentCommit)
|
||||
v := version.CurrentVersionNumber
|
||||
if version.CurrentCommit != "" {
|
||||
v += "-" + version.CurrentCommit
|
||||
}
|
||||
fmt.Printf("go-ipfs version: %s\n", v)
|
||||
fmt.Printf("Repo version: %d\n", fsrepo.RepoVersion)
|
||||
fmt.Printf("System version: %s\n", runtime.GOARCH+"/"+runtime.GOOS)
|
||||
fmt.Printf("Golang version: %s\n", runtime.Version())
|
||||
|
||||
@ -54,21 +54,25 @@ var VersionCmd = &cmds.Command{
|
||||
},
|
||||
Encoders: cmds.EncoderMap{
|
||||
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, version *VersionOutput) error {
|
||||
commit, _ := req.Options[versionCommitOptionName].(bool)
|
||||
commitTxt := ""
|
||||
if commit {
|
||||
commitTxt = "-" + version.Commit
|
||||
}
|
||||
|
||||
all, _ := req.Options[versionAllOptionName].(bool)
|
||||
if all {
|
||||
out := fmt.Sprintf("go-ipfs version: %s-%s\n"+
|
||||
ver := version.Version
|
||||
if version.Commit != "" {
|
||||
ver += "-" + version.Commit
|
||||
}
|
||||
out := fmt.Sprintf("go-ipfs version: %s\n"+
|
||||
"Repo version: %s\nSystem version: %s\nGolang version: %s\n",
|
||||
version.Version, version.Commit, version.Repo, version.System, version.Golang)
|
||||
ver, version.Repo, version.System, version.Golang)
|
||||
fmt.Fprint(w, out)
|
||||
return nil
|
||||
}
|
||||
|
||||
commit, _ := req.Options[versionCommitOptionName].(bool)
|
||||
commitTxt := ""
|
||||
if commit && version.Commit != "" {
|
||||
commitTxt = "-" + version.Commit
|
||||
}
|
||||
|
||||
repo, _ := req.Options[versionRepoOptionName].(bool)
|
||||
if repo {
|
||||
fmt.Fprintln(w, version.Repo)
|
||||
|
||||
@ -12,6 +12,7 @@ package core
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"path"
|
||||
|
||||
"github.com/ipfs/go-filestore"
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
@ -54,7 +55,7 @@ import (
|
||||
var log = logging.Logger("core")
|
||||
|
||||
func init() {
|
||||
identify.ClientVersion = "go-ipfs/" + version.CurrentVersionNumber + "/" + version.CurrentCommit
|
||||
identify.ClientVersion = path.Join("go-ipfs", version.CurrentVersionNumber, version.CurrentCommit)
|
||||
}
|
||||
|
||||
// IpfsNode is IPFS Core module. It represents an IPFS instance.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user