forked from TrueCloudLab/neoneo-go
cli: change --version output format, fix #2611
This commit is contained in:
parent
1ff588a11b
commit
eb67b61c0f
2 changed files with 13 additions and 1 deletions
10
cli/main.go
10
cli/main.go
|
@ -1,7 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/cli/query"
|
||||
"github.com/nspcc-dev/neo-go/cli/server"
|
||||
|
@ -21,7 +23,15 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
func versionPrinter(c *cli.Context) {
|
||||
_, _ = fmt.Fprintf(c.App.Writer, "NeoGo\nVersion: %s\nGoVersion: %s\n",
|
||||
config.Version,
|
||||
runtime.Version(),
|
||||
)
|
||||
}
|
||||
|
||||
func newApp() *cli.App {
|
||||
cli.VersionPrinter = versionPrinter
|
||||
ctl := cli.NewApp()
|
||||
ctl.Name = "neo-go"
|
||||
ctl.Version = config.Version
|
||||
|
|
|
@ -7,6 +7,8 @@ import (
|
|||
func TestCLIVersion(t *testing.T) {
|
||||
e := newExecutor(t, false)
|
||||
e.Run(t, "neo-go", "--version")
|
||||
e.checkNextLine(t, "^neo-go version")
|
||||
e.checkNextLine(t, "^NeoGo")
|
||||
e.checkNextLine(t, "^Version:")
|
||||
e.checkNextLine(t, "^GoVersion:")
|
||||
e.checkEOF(t)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue