mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
1ac60ada19
Refs. #2379, but not completely solves it, one package seriously outweights others: ? github.com/nspcc-dev/neo-go/cli [no test files] ok github.com/nspcc-dev/neo-go/cli/app 0.036s coverage: 100.0% of statements ok github.com/nspcc-dev/neo-go/cli/cmdargs 0.011s coverage: 60.8% of statements ok github.com/nspcc-dev/neo-go/cli/flags 0.009s coverage: 97.7% of statements ? github.com/nspcc-dev/neo-go/cli/input [no test files] ok github.com/nspcc-dev/neo-go/cli/options 0.033s coverage: 50.0% of statements ? github.com/nspcc-dev/neo-go/cli/paramcontext [no test files] ok github.com/nspcc-dev/neo-go/cli/query 2.155s coverage: 45.3% of statements ok github.com/nspcc-dev/neo-go/cli/server 1.373s coverage: 67.8% of statements ok github.com/nspcc-dev/neo-go/cli/smartcontract 8.819s coverage: 94.3% of statements ok github.com/nspcc-dev/neo-go/cli/util 0.006s coverage: 10.9% of statements ? github.com/nspcc-dev/neo-go/cli/vm [no test files] ok github.com/nspcc-dev/neo-go/cli/wallet 72.103s coverage: 88.2% of statements Still a nice thing to have.
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package app
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
|
|
"github.com/nspcc-dev/neo-go/cli/query"
|
|
"github.com/nspcc-dev/neo-go/cli/server"
|
|
"github.com/nspcc-dev/neo-go/cli/smartcontract"
|
|
"github.com/nspcc-dev/neo-go/cli/util"
|
|
"github.com/nspcc-dev/neo-go/cli/vm"
|
|
"github.com/nspcc-dev/neo-go/cli/wallet"
|
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
func versionPrinter(c *cli.Context) {
|
|
_, _ = fmt.Fprintf(c.App.Writer, "NeoGo\nVersion: %s\nGoVersion: %s\n",
|
|
config.Version,
|
|
runtime.Version(),
|
|
)
|
|
}
|
|
|
|
// New creates a NeoGo instance of [cli.App] with all commands included.
|
|
func New() *cli.App {
|
|
cli.VersionPrinter = versionPrinter
|
|
ctl := cli.NewApp()
|
|
ctl.Name = "neo-go"
|
|
ctl.Version = config.Version
|
|
ctl.Usage = "Official Go client for Neo"
|
|
ctl.ErrWriter = os.Stdout
|
|
|
|
ctl.Commands = append(ctl.Commands, server.NewCommands()...)
|
|
ctl.Commands = append(ctl.Commands, smartcontract.NewCommands()...)
|
|
ctl.Commands = append(ctl.Commands, wallet.NewCommands()...)
|
|
ctl.Commands = append(ctl.Commands, vm.NewCommands()...)
|
|
ctl.Commands = append(ctl.Commands, util.NewCommands()...)
|
|
ctl.Commands = append(ctl.Commands, query.NewCommands()...)
|
|
return ctl
|
|
}
|