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

@ -40,35 +40,39 @@ func NewCommands() []cli.Command {
Usage: "Query data from RPC node",
Subcommands: []cli.Command{
{
Name: "candidates",
Usage: "Get candidates and votes",
Action: queryCandidates,
Flags: options.RPC,
Name: "candidates",
Usage: "Get candidates and votes",
UsageText: "neo-go query candidates -r endpoint [-s timeout]",
Action: queryCandidates,
Flags: options.RPC,
},
{
Name: "committee",
Usage: "Get committee list",
Action: queryCommittee,
Flags: options.RPC,
Name: "committee",
Usage: "Get committee list",
UsageText: "neo-go query committee -r endpoint [-s timeout]",
Action: queryCommittee,
Flags: options.RPC,
},
{
Name: "height",
Usage: "Get node height",
Action: queryHeight,
Flags: options.RPC,
Name: "height",
Usage: "Get node height",
UsageText: "neo-go query height -r endpoint [-s timeout]",
Action: queryHeight,
Flags: options.RPC,
},
{
Name: "tx",
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,
Flags: queryTxFlags,
},
{
Name: "voter",
Usage: "Print NEO holder account state",
Action: queryVoter,
Flags: options.RPC,
Name: "voter",
Usage: "Print NEO holder account state",
UsageText: "neo-go query voter <address> -r endpoint [-s timeout]",
Action: queryVoter,
Flags: options.RPC,
},
},
}}

View file

@ -86,26 +86,29 @@ func NewCommands() []cli.Command {
)
return []cli.Command{
{
Name: "node",
Usage: "start a NEO node",
Action: startServer,
Flags: cfgFlags,
Name: "node",
Usage: "start a NEO node",
UsageText: "neo-go node [--config-path path] [-d] [-p/-m/-t]",
Action: startServer,
Flags: cfgFlags,
},
{
Name: "db",
Usage: "database manipulations",
Subcommands: []cli.Command{
{
Name: "dump",
Usage: "dump blocks (starting with block #1) to the file",
Action: dumpDB,
Flags: cfgCountOutFlags,
Name: "dump",
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,
Flags: cfgCountOutFlags,
},
{
Name: "restore",
Usage: "restore blocks from the file",
Action: restoreDB,
Flags: cfgCountInFlags,
Name: "restore",
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,
Flags: cfgCountInFlags,
},
},
},

View file

@ -136,9 +136,10 @@ func NewCommands() []cli.Command {
Usage: "compile - debug - deploy smart contracts",
Subcommands: []cli.Command{
{
Name: "compile",
Usage: "compile a smart contract to a .nef file",
Action: contractCompile,
Name: "compile",
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,
Flags: []cli.Flag{
cli.StringFlag{
Name: "in, i",
@ -340,9 +341,10 @@ func NewCommands() []cli.Command {
Flags: testInvokeScriptFlags,
},
{
Name: "init",
Usage: "initialize a new smart-contract in a directory with boiler plate code",
Action: initSmartContract,
Name: "init",
Usage: "initialize a new smart-contract in a directory with boiler plate code",
UsageText: "neo-go contract init -n name [--skip-details]",
Action: initSmartContract,
Flags: []cli.Flag{
cli.StringFlag{
Name: "name, n",
@ -355,9 +357,10 @@ func NewCommands() []cli.Command {
},
},
{
Name: "inspect",
Usage: "creates a user readable dump of the program instructions",
Action: inspect,
Name: "inspect",
Usage: "creates a user readable dump of the program instructions",
UsageText: "neo-go contract inspect -i file [-c]",
Action: inspect,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "compile, c",
@ -370,9 +373,10 @@ func NewCommands() []cli.Command {
},
},
{
Name: "calc-hash",
Usage: "calculates hash of a contract after deployment",
Action: calcHash,
Name: "calc-hash",
Usage: "calculates hash of a contract after deployment",
UsageText: "neo-go contract calc-hash -i nef -m manifest -s address",
Action: calcHash,
Flags: []cli.Flag{
flags.AddressFlag{
Name: "sender, s",
@ -393,9 +397,10 @@ func NewCommands() []cli.Command {
Usage: "manifest-related commands",
Subcommands: []cli.Command{
{
Name: "add-group",
Usage: "adds group to the manifest",
Action: manifestAddGroup,
Name: "add-group",
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,
Flags: []cli.Flag{
walletFlag,
walletConfigFlag,

View file

@ -110,15 +110,17 @@ func NewCommands() []cli.Command {
Usage: "create, open and manage a NEO wallet",
Subcommands: []cli.Command{
{
Name: "claim",
Usage: "claim GAS",
Action: claimGas,
Flags: claimFlags,
Name: "claim",
Usage: "claim GAS",
UsageText: "neo-go wallet claim -w wallet [--wallet-config path] -a address -r endpoint [-s timeout]",
Action: claimGas,
Flags: claimFlags,
},
{
Name: "init",
Usage: "create a new wallet",
Action: createWallet,
Name: "init",
Usage: "create a new wallet",
UsageText: "neo-go wallet init -w wallet [--wallet-config path] [-a]",
Action: createWallet,
Flags: []cli.Flag{
walletPathFlag,
walletConfigFlag,
@ -129,9 +131,10 @@ func NewCommands() []cli.Command {
},
},
{
Name: "change-password",
Usage: "change password for accounts",
Action: changePassword,
Name: "change-password",
Usage: "change password for accounts",
UsageText: "neo-go wallet change-password -w wallet -a address",
Action: changePassword,
Flags: []cli.Flag{
walletPathFlag,
flags.AddressFlag{
@ -141,9 +144,10 @@ func NewCommands() []cli.Command {
},
},
{
Name: "convert",
Usage: "convert addresses from existing NEO2 NEP6-wallet to NEO3 format",
Action: convertWallet,
Name: "convert",
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,
Flags: []cli.Flag{
walletPathFlag,
walletConfigFlag,
@ -154,18 +158,20 @@ func NewCommands() []cli.Command {
},
},
{
Name: "create",
Usage: "add an account to the existing wallet",
Action: addAccount,
Name: "create",
Usage: "add an account to the existing wallet",
UsageText: "neo-go wallet create -w wallet [--wallet-config path]",
Action: addAccount,
Flags: []cli.Flag{
walletPathFlag,
walletConfigFlag,
},
},
{
Name: "dump",
Usage: "check and dump an existing NEO wallet",
Action: dumpWallet,
Name: "dump",
Usage: "check and dump an existing NEO wallet",
UsageText: "neo-go wallet dump -w wallet [--wallet-config path] [-d]",
Action: dumpWallet,
Flags: []cli.Flag{
walletPathFlag,
walletConfigFlag,
@ -173,9 +179,10 @@ func NewCommands() []cli.Command {
},
},
{
Name: "dump-keys",
Usage: "dump public keys for account",
Action: dumpKeys,
Name: "dump-keys",
Usage: "dump public keys for account",
UsageText: "neo-go wallet dump-keys -w wallet [--wallet-config path] [-a address]",
Action: dumpKeys,
Flags: []cli.Flag{
walletPathFlag,
walletConfigFlag,