cli: add UsageText to commands that were missing it

Makes --help a bit more useful.
This commit is contained in:
Roman Khimov 2022-08-05 16:23:50 +03:00
parent 1367d0df00
commit 28e2010cbd
4 changed files with 85 additions and 66 deletions

View file

@ -42,31 +42,35 @@ func NewCommands() []cli.Command {
{ {
Name: "candidates", Name: "candidates",
Usage: "Get candidates and votes", Usage: "Get candidates and votes",
UsageText: "neo-go query candidates -r endpoint [-s timeout]",
Action: queryCandidates, Action: queryCandidates,
Flags: options.RPC, Flags: options.RPC,
}, },
{ {
Name: "committee", Name: "committee",
Usage: "Get committee list", Usage: "Get committee list",
UsageText: "neo-go query committee -r endpoint [-s timeout]",
Action: queryCommittee, Action: queryCommittee,
Flags: options.RPC, Flags: options.RPC,
}, },
{ {
Name: "height", Name: "height",
Usage: "Get node height", Usage: "Get node height",
UsageText: "neo-go query height -r endpoint [-s timeout]",
Action: queryHeight, Action: queryHeight,
Flags: options.RPC, Flags: options.RPC,
}, },
{ {
Name: "tx", Name: "tx",
Usage: "Query transaction status", Usage: "Query transaction status",
UsageText: "neo-go query tx <hash> -r endpoint [-v]", UsageText: "neo-go query tx <hash> -r endpoint [-s timeout] [-v]",
Action: queryTx, Action: queryTx,
Flags: queryTxFlags, Flags: queryTxFlags,
}, },
{ {
Name: "voter", Name: "voter",
Usage: "Print NEO holder account state", Usage: "Print NEO holder account state",
UsageText: "neo-go query voter <address> -r endpoint [-s timeout]",
Action: queryVoter, Action: queryVoter,
Flags: options.RPC, Flags: options.RPC,
}, },

View file

@ -88,6 +88,7 @@ func NewCommands() []cli.Command {
{ {
Name: "node", Name: "node",
Usage: "start a NEO node", Usage: "start a NEO node",
UsageText: "neo-go node [--config-path path] [-d] [-p/-m/-t]",
Action: startServer, Action: startServer,
Flags: cfgFlags, Flags: cfgFlags,
}, },
@ -98,12 +99,14 @@ func NewCommands() []cli.Command {
{ {
Name: "dump", Name: "dump",
Usage: "dump blocks (starting with block #1) to the file", Usage: "dump blocks (starting with block #1) to the file",
UsageText: "neo-go db dump -o file [-s start] [-c count] [--config-path path] [-p/-m/-t]",
Action: dumpDB, Action: dumpDB,
Flags: cfgCountOutFlags, Flags: cfgCountOutFlags,
}, },
{ {
Name: "restore", Name: "restore",
Usage: "restore blocks from the file", Usage: "restore blocks from the file",
UsageText: "neo-go db restore -i file [--dump] [-n] [-c count] [--config-path path] [-p/-m/-t]",
Action: restoreDB, Action: restoreDB,
Flags: cfgCountInFlags, Flags: cfgCountInFlags,
}, },

View file

@ -138,6 +138,7 @@ func NewCommands() []cli.Command {
{ {
Name: "compile", Name: "compile",
Usage: "compile a smart contract to a .nef file", Usage: "compile a smart contract to a .nef file",
UsageText: "neo-go contract compile -i path [-o nef] [-v] [-d] [-m manifest] [-c yaml] [--bindings file] [--no-standards] [--no-events] [--no-permissions]",
Action: contractCompile, Action: contractCompile,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{
@ -342,6 +343,7 @@ func NewCommands() []cli.Command {
{ {
Name: "init", Name: "init",
Usage: "initialize a new smart-contract in a directory with boiler plate code", Usage: "initialize a new smart-contract in a directory with boiler plate code",
UsageText: "neo-go contract init -n name [--skip-details]",
Action: initSmartContract, Action: initSmartContract,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{
@ -357,6 +359,7 @@ func NewCommands() []cli.Command {
{ {
Name: "inspect", Name: "inspect",
Usage: "creates a user readable dump of the program instructions", Usage: "creates a user readable dump of the program instructions",
UsageText: "neo-go contract inspect -i file [-c]",
Action: inspect, Action: inspect,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.BoolFlag{ cli.BoolFlag{
@ -372,6 +375,7 @@ func NewCommands() []cli.Command {
{ {
Name: "calc-hash", Name: "calc-hash",
Usage: "calculates hash of a contract after deployment", Usage: "calculates hash of a contract after deployment",
UsageText: "neo-go contract calc-hash -i nef -m manifest -s address",
Action: calcHash, Action: calcHash,
Flags: []cli.Flag{ Flags: []cli.Flag{
flags.AddressFlag{ flags.AddressFlag{
@ -395,6 +399,7 @@ func NewCommands() []cli.Command {
{ {
Name: "add-group", Name: "add-group",
Usage: "adds group to the manifest", Usage: "adds group to the manifest",
UsageText: "neo-go contract manifest add-group -w wallet [--wallet-config path] -n nef -m manifest -a address -s address",
Action: manifestAddGroup, Action: manifestAddGroup,
Flags: []cli.Flag{ Flags: []cli.Flag{
walletFlag, walletFlag,

View file

@ -112,12 +112,14 @@ func NewCommands() []cli.Command {
{ {
Name: "claim", Name: "claim",
Usage: "claim GAS", Usage: "claim GAS",
UsageText: "neo-go wallet claim -w wallet [--wallet-config path] -a address -r endpoint [-s timeout]",
Action: claimGas, Action: claimGas,
Flags: claimFlags, Flags: claimFlags,
}, },
{ {
Name: "init", Name: "init",
Usage: "create a new wallet", Usage: "create a new wallet",
UsageText: "neo-go wallet init -w wallet [--wallet-config path] [-a]",
Action: createWallet, Action: createWallet,
Flags: []cli.Flag{ Flags: []cli.Flag{
walletPathFlag, walletPathFlag,
@ -131,6 +133,7 @@ func NewCommands() []cli.Command {
{ {
Name: "change-password", Name: "change-password",
Usage: "change password for accounts", Usage: "change password for accounts",
UsageText: "neo-go wallet change-password -w wallet -a address",
Action: changePassword, Action: changePassword,
Flags: []cli.Flag{ Flags: []cli.Flag{
walletPathFlag, walletPathFlag,
@ -143,6 +146,7 @@ func NewCommands() []cli.Command {
{ {
Name: "convert", Name: "convert",
Usage: "convert addresses from existing NEO2 NEP6-wallet to NEO3 format", Usage: "convert addresses from existing NEO2 NEP6-wallet to NEO3 format",
UsageText: "neo-go wallet convert -w legacywallet [--wallet-config path] -o n3wallet",
Action: convertWallet, Action: convertWallet,
Flags: []cli.Flag{ Flags: []cli.Flag{
walletPathFlag, walletPathFlag,
@ -156,6 +160,7 @@ func NewCommands() []cli.Command {
{ {
Name: "create", Name: "create",
Usage: "add an account to the existing wallet", Usage: "add an account to the existing wallet",
UsageText: "neo-go wallet create -w wallet [--wallet-config path]",
Action: addAccount, Action: addAccount,
Flags: []cli.Flag{ Flags: []cli.Flag{
walletPathFlag, walletPathFlag,
@ -165,6 +170,7 @@ func NewCommands() []cli.Command {
{ {
Name: "dump", Name: "dump",
Usage: "check and dump an existing NEO wallet", Usage: "check and dump an existing NEO wallet",
UsageText: "neo-go wallet dump -w wallet [--wallet-config path] [-d]",
Action: dumpWallet, Action: dumpWallet,
Flags: []cli.Flag{ Flags: []cli.Flag{
walletPathFlag, walletPathFlag,
@ -175,6 +181,7 @@ func NewCommands() []cli.Command {
{ {
Name: "dump-keys", Name: "dump-keys",
Usage: "dump public keys for account", Usage: "dump public keys for account",
UsageText: "neo-go wallet dump-keys -w wallet [--wallet-config path] [-a address]",
Action: dumpKeys, Action: dumpKeys,
Flags: []cli.Flag{ Flags: []cli.Flag{
walletPathFlag, walletPathFlag,