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", Usage: "Query data from RPC node",
Subcommands: []cli.Command{ Subcommands: []cli.Command{
{ {
Name: "candidates", Name: "candidates",
Usage: "Get candidates and votes", Usage: "Get candidates and votes",
Action: queryCandidates, UsageText: "neo-go query candidates -r endpoint [-s timeout]",
Flags: options.RPC, Action: queryCandidates,
Flags: options.RPC,
}, },
{ {
Name: "committee", Name: "committee",
Usage: "Get committee list", Usage: "Get committee list",
Action: queryCommittee, UsageText: "neo-go query committee -r endpoint [-s timeout]",
Flags: options.RPC, Action: queryCommittee,
Flags: options.RPC,
}, },
{ {
Name: "height", Name: "height",
Usage: "Get node height", Usage: "Get node height",
Action: queryHeight, UsageText: "neo-go query height -r endpoint [-s timeout]",
Flags: options.RPC, Action: queryHeight,
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",
Action: queryVoter, UsageText: "neo-go query voter <address> -r endpoint [-s timeout]",
Flags: options.RPC, Action: queryVoter,
Flags: options.RPC,
}, },
}, },
}} }}

View file

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

View file

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

View file

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