cli: refactor usage field

Unified style is with lowercase letter.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2024-06-07 11:00:14 +03:00
parent cf4d4a2611
commit e95d87779b
11 changed files with 85 additions and 85 deletions

View file

@ -30,44 +30,44 @@ func NewCommands() []cli.Command {
queryTxFlags := append([]cli.Flag{
cli.BoolFlag{
Name: "verbose, v",
Usage: "Output full tx info and execution logs",
Usage: "output full tx info and execution logs",
},
}, options.RPC...)
return []cli.Command{{
Name: "query",
Usage: "Query data from RPC node",
Usage: "query data from RPC node",
Subcommands: []cli.Command{
{
Name: "candidates",
Usage: "Get candidates and votes",
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",
Usage: "get committee list",
UsageText: "neo-go query committee -r endpoint [-s timeout]",
Action: queryCommittee,
Flags: options.RPC,
},
{
Name: "height",
Usage: "Get node 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",
Usage: "query transaction status",
UsageText: "neo-go query tx <hash> -r endpoint [-s timeout] [-v]",
Action: queryTx,
Flags: queryTxFlags,
},
{
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,
Flags: options.RPC,

View file

@ -55,7 +55,7 @@ func NewCommands() []cli.Command {
},
cli.StringFlag{
Name: "out, o",
Usage: "Output file (stdout if not given)",
Usage: "output file (stdout if not given)",
},
)
var cfgCountInFlags = make([]cli.Flag, len(cfgWithCountFlags))
@ -63,7 +63,7 @@ func NewCommands() []cli.Command {
cfgCountInFlags = append(cfgCountInFlags,
cli.StringFlag{
Name: "in, i",
Usage: "Input file (stdin if not given)",
Usage: "input file (stdin if not given)",
},
cli.StringFlag{
Name: "dump",
@ -78,7 +78,7 @@ func NewCommands() []cli.Command {
copy(cfgHeightFlags, cfgFlags)
cfgHeightFlags[len(cfgHeightFlags)-1] = cli.UintFlag{
Name: "height",
Usage: "Height of the state to reset DB to",
Usage: "height of the state to reset DB to",
Required: true,
}
return []cli.Command{

View file

@ -16,21 +16,21 @@ import (
var generatorFlags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
Usage: "Configuration file to use",
Usage: "configuration file to use",
},
cli.StringFlag{
Name: "manifest, m",
Required: true,
Usage: "Read contract manifest (*.manifest.json) file",
Usage: "read contract manifest (*.manifest.json) file",
},
cli.StringFlag{
Name: "out, o",
Required: true,
Usage: "Output of the compiled wrapper",
Usage: "output of the compiled wrapper",
},
cli.StringFlag{
Name: "hash",
Usage: "Smart-contract hash. If not passed, the wrapper will be designed for dynamic hash usage",
Usage: "smart-contract hash. If not passed, the wrapper will be designed for dynamic hash usage",
},
}

View file

@ -78,7 +78,7 @@ func NewCommands() []cli.Command {
testInvokeScriptFlags := []cli.Flag{
cli.StringFlag{
Name: "in, i",
Usage: "Input location of the .nef file that needs to be invoked",
Usage: "input location of the .nef file that needs to be invoked",
},
options.Historic,
}
@ -98,11 +98,11 @@ func NewCommands() []cli.Command {
deployFlags := append(invokeFunctionFlags, []cli.Flag{
cli.StringFlag{
Name: "in, i",
Usage: "Input file for the smart contract (*.nef)",
Usage: "input file for the smart contract (*.nef)",
},
cli.StringFlag{
Name: "manifest, m",
Usage: "Manifest input file (*.manifest.json)",
Usage: "manifest input file (*.manifest.json)",
},
}...)
manifestAddGroupFlags := append([]cli.Flag{
@ -143,27 +143,27 @@ func NewCommands() []cli.Command {
Flags: []cli.Flag{
cli.StringFlag{
Name: "in, i",
Usage: "Input file for the smart contract to be compiled (*.go file or directory)",
Usage: "input file for the smart contract to be compiled (*.go file or directory)",
},
cli.StringFlag{
Name: "out, o",
Usage: "Output of the compiled contract",
Usage: "output of the compiled contract",
},
cli.BoolFlag{
Name: "verbose, v",
Usage: "Print out additional information after a compiling",
Usage: "print out additional information after a compiling",
},
cli.StringFlag{
Name: "debug, d",
Usage: "Emit debug info in a separate file",
Usage: "emit debug info in a separate file",
},
cli.StringFlag{
Name: "manifest, m",
Usage: "Emit contract manifest (*.manifest.json) file into separate file using configuration input file (*.yml)",
Usage: "emit contract manifest (*.manifest.json) file into separate file using configuration input file (*.yml)",
},
cli.StringFlag{
Name: "config, c",
Usage: "Configuration input file (*.yml)",
Usage: "configuration input file (*.yml)",
},
cli.BoolFlag{
Name: "no-standards",
@ -239,7 +239,7 @@ func NewCommands() []cli.Command {
},
{
Name: "testinvokescript",
Usage: "Invoke compiled AVM code in NEF format on the blockchain (test mode, not creating a transaction for it)",
Usage: "invoke compiled AVM code in NEF format on the blockchain (test mode, not creating a transaction for it)",
UsageText: "neo-go contract testinvokescript -r endpoint -i input.nef [--historic index/hash] [signers...]",
Description: `Executes given compiled AVM instructions in NEF format with the given set of
signers not included sender by default. See testinvokefunction documentation

View file

@ -38,7 +38,7 @@ var (
// ForceFlag is a flag used to force transaction send.
ForceFlag = cli.BoolFlag{
Name: "force",
Usage: "Do not ask for a confirmation (and ignore errors)",
Usage: "do not ask for a confirmation (and ignore errors)",
}
// AwaitFlag is a flag used to wait for the transaction to be included in a block.
AwaitFlag = cli.BoolFlag{

View file

@ -30,11 +30,11 @@ func NewCommands() []cli.Command {
return []cli.Command{
{
Name: "util",
Usage: "Various helper commands",
Usage: "various helper commands",
Subcommands: []cli.Command{
{
Name: "convert",
Usage: "Convert provided argument into other possible formats",
Usage: "convert provided argument into other possible formats",
UsageText: `convert <arg>
<arg> is an argument which is tried to be interpreted as an item of different types
@ -43,7 +43,7 @@ func NewCommands() []cli.Command {
},
{
Name: "sendtx",
Usage: "Send complete transaction stored in a context file",
Usage: "send complete transaction stored in a context file",
UsageText: "sendtx [-r <endpoint>] <file.in> [--await]",
Description: `Sends the transaction from the given context file to the given RPC node if it's
completely signed and ready. This command expects a ContractParametersContext
@ -56,7 +56,7 @@ func NewCommands() []cli.Command {
},
{
Name: "canceltx",
Usage: "Cancel transaction by sending conflicting transaction",
Usage: "cancel transaction by sending conflicting transaction",
UsageText: "canceltx <txid> -r <endpoint> --wallet <wallet> [--account <account>] [--wallet-config <path>] [--gas <gas>] [--await]",
Description: `Aims to prevent a transaction from being added to the blockchain by dispatching a more
prioritized conflicting transaction to the specified RPC node. The input for this command should
@ -76,7 +76,7 @@ func NewCommands() []cli.Command {
},
{
Name: "txdump",
Usage: "Dump transaction stored in file",
Usage: "dump transaction stored in file",
UsageText: "txdump [-r <endpoint>] <file.in>",
Action: txDump,
Flags: txDumpFlags,
@ -89,7 +89,7 @@ func NewCommands() []cli.Command {
},
{
Name: "ops",
Usage: "Pretty-print VM opcodes of the given base64- or hex- encoded script (base64 is checked first). If the input file is specified, then the script is taken from the file.",
Usage: "pretty-print VM opcodes of the given base64- or hex- encoded script (base64 is checked first). If the input file is specified, then the script is taken from the file.",
UsageText: "ops <base64/hex-encoded script> [-i path-to-file] [--hex]",
Action: handleOps,
Flags: []cli.Flag{

View file

@ -72,7 +72,7 @@ const (
var (
historicFlag = cli.IntFlag{
Name: historicFlagFullName,
Usage: "Height for historic script invocation (for MPT-enabled blockchain configuration with KeepOnlyLatestState setting disabled). " +
Usage: "height for historic script invocation (for MPT-enabled blockchain configuration with KeepOnlyLatestState setting disabled). " +
"Assuming that block N-th is specified as an argument, the historic invocation is based on the storage state of height N and fake currently-accepting block with index N+1.",
}
gasFlag = cli.Int64Flag{
@ -81,28 +81,28 @@ var (
}
hashFlag = cli.StringFlag{
Name: hashFlagFullName,
Usage: "Smart-contract hash in LE form or address",
Usage: "smart-contract hash in LE form or address",
}
)
var commands = []cli.Command{
{
Name: "exit",
Usage: "Exit the VM prompt",
Usage: "exit the VM prompt",
UsageText: "exit",
Description: "Exit the VM prompt.",
Action: handleExit,
},
{
Name: "ip",
Usage: "Show current instruction",
Usage: "show current instruction",
UsageText: "ip",
Description: "Show current instruction.",
Action: handleIP,
},
{
Name: "break",
Usage: "Place a breakpoint",
Usage: "place a breakpoint",
UsageText: `break <ip>`,
Description: `<ip> is mandatory parameter.
@ -112,7 +112,7 @@ Example:
},
{
Name: "jump",
Usage: "Jump to the specified instruction (absolute IP value)",
Usage: "jump to the specified instruction (absolute IP value)",
UsageText: `jump <ip>`,
Description: `<ip> is mandatory parameter (absolute IP value).
@ -122,42 +122,42 @@ Example:
},
{
Name: "estack",
Usage: "Show evaluation stack contents",
Usage: "show evaluation stack contents",
UsageText: "estack",
Description: "Show evaluation stack contents.",
Action: handleXStack,
},
{
Name: "istack",
Usage: "Show invocation stack contents",
Usage: "show invocation stack contents",
UsageText: "istack",
Description: "Show invocation stack contents.",
Action: handleXStack,
},
{
Name: "sslot",
Usage: "Show static slot contents",
Usage: "show static slot contents",
UsageText: "sslot",
Description: "Show static slot contents.",
Action: handleSlots,
},
{
Name: "lslot",
Usage: "Show local slot contents",
Usage: "show local slot contents",
UsageText: "lslot",
Description: "Show local slot contents",
Action: handleSlots,
},
{
Name: "aslot",
Usage: "Show arguments slot contents",
Usage: "show arguments slot contents",
UsageText: "aslot",
Description: "Show arguments slot contents.",
Action: handleSlots,
},
{
Name: "loadnef",
Usage: "Load a NEF (possibly with a contract hash) into the VM optionally using provided scoped signers in the context",
Usage: "load a NEF (possibly with a contract hash) into the VM optionally using provided scoped signers in the context",
UsageText: `loadnef [--historic <height>] [--gas <int>] [--hash <hash-or-address>] <file> [<manifest>] [-- <signer-with-scope>, ...]`,
Flags: []cli.Flag{historicFlag, gasFlag, hashFlag},
Description: `<file> parameter is mandatory, <manifest> parameter (if omitted) will
@ -172,7 +172,7 @@ Example:
},
{
Name: "loadbase64",
Usage: "Load a base64-encoded script string into the VM optionally attaching to it provided signers with scopes",
Usage: "load a base64-encoded script string into the VM optionally attaching to it provided signers with scopes",
UsageText: `loadbase64 [--historic <height>] [--gas <int>] <string> [-- <signer-with-scope>, ...]`,
Flags: []cli.Flag{historicFlag, gasFlag},
Description: `<string> is mandatory parameter.
@ -185,7 +185,7 @@ Example:
},
{
Name: "loadhex",
Usage: "Load a hex-encoded script string into the VM optionally attaching to it provided signers with scopes",
Usage: "load a hex-encoded script string into the VM optionally attaching to it provided signers with scopes",
UsageText: `loadhex [--historic <height>] [--gas <int>] <string> [-- <signer-with-scope>, ...]`,
Flags: []cli.Flag{historicFlag, gasFlag},
Description: `<string> is mandatory parameter.
@ -198,7 +198,7 @@ Example:
},
{
Name: "loadgo",
Usage: "Compile and load a Go file with the manifest into the VM optionally attaching to it provided signers with scopes and setting provided hash",
Usage: "compile and load a Go file with the manifest into the VM optionally attaching to it provided signers with scopes and setting provided hash",
UsageText: `loadgo [--historic <height>] [--gas <int>] [--hash <hash-or-address>] <file> [-- <signer-with-scope>, ...]`,
Flags: []cli.Flag{historicFlag, gasFlag, hashFlag},
Description: `<file> is mandatory parameter.
@ -211,7 +211,7 @@ Example:
},
{
Name: "loadtx",
Usage: "Load transaction into the VM from chain or from parameter context file",
Usage: "load transaction into the VM from chain or from parameter context file",
UsageText: `loadtx [--historic <height>] [--gas <int>] <file-or-hash>`,
Flags: []cli.Flag{historicFlag, gasFlag},
Description: `Load transaction into the VM from chain or from parameter context file.
@ -228,7 +228,7 @@ Example:
},
{
Name: "loaddeployed",
Usage: "Load deployed contract into the VM from chain optionally attaching to it provided signers with scopes",
Usage: "load deployed contract into the VM from chain optionally attaching to it provided signers with scopes",
UsageText: `loaddeployed [--historic <height>] [--gas <int>] <hash-or-address-or-id> [-- <signer-with-scope>, ...]`,
Flags: []cli.Flag{historicFlag, gasFlag},
Description: `Load deployed contract into the VM from chain optionally attaching to it provided signers with scopes.
@ -244,7 +244,7 @@ Example:
},
{
Name: "reset",
Usage: "Unload compiled script from the VM and reset context to proper (possibly, historic) state",
Usage: "unload compiled script from the VM and reset context to proper (possibly, historic) state",
UsageText: "reset",
Flags: []cli.Flag{historicFlag},
Description: "Unload compiled script from the VM and reset context to proper (possibly, historic) state.",
@ -252,7 +252,7 @@ Example:
},
{
Name: "parse",
Usage: "Parse provided argument and convert it into other possible formats",
Usage: "parse provided argument and convert it into other possible formats",
UsageText: `parse <arg>`,
Description: `<arg> is an argument which is tried to be interpreted as an item of different types
and converted to other formats. Strings are escaped and output in quotes.`,
@ -260,7 +260,7 @@ and converted to other formats. Strings are escaped and output in quotes.`,
},
{
Name: "run",
Usage: "Usage Execute the current loaded script",
Usage: "usage Execute the current loaded script",
UsageText: `run [<method> [<parameter>...]]`,
Description: `<method> is a contract method, specified in manifest. It can be '_' which will push
parameters onto the stack and execute from the current offset.
@ -275,14 +275,14 @@ Example:
},
{
Name: "cont",
Usage: "Continue execution of the current loaded script",
Usage: "continue execution of the current loaded script",
UsageText: "cont",
Description: "Continue execution of the current loaded script.",
Action: handleCont,
},
{
Name: "step",
Usage: "Step (n) instruction in the program",
Usage: "step (n) instruction in the program",
UsageText: `step [<n>]`,
Description: `<n> is optional parameter to specify number of instructions to run.
@ -292,7 +292,7 @@ Example:
},
{
Name: "stepinto",
Usage: "Stepinto instruction to take in the debugger",
Usage: "stepinto instruction to take in the debugger",
UsageText: "stepinto",
Description: `Stepinto instruction to take in the debugger.
@ -302,7 +302,7 @@ Example:
},
{
Name: "stepout",
Usage: "Stepout instruction to take in the debugger",
Usage: "stepout instruction to take in the debugger",
UsageText: "stepout",
Description: `Stepout instruction to take in the debugger.
@ -312,7 +312,7 @@ Example:
},
{
Name: "stepover",
Usage: "Stepover instruction to take in the debugger",
Usage: "stepover instruction to take in the debugger",
UsageText: "stepover",
Description: `Stepover instruction to take in the debugger.
@ -322,26 +322,26 @@ Example:
},
{
Name: "ops",
Usage: "Dump opcodes of the current loaded program",
Usage: "dump opcodes of the current loaded program",
UsageText: "ops",
Description: "Dump opcodes of the current loaded program",
Action: handleOps,
},
{
Name: "events",
Usage: "Dump events emitted by the current loaded program",
Usage: "dump events emitted by the current loaded program",
UsageText: "events",
Description: "Dump events emitted by the current loaded program",
Action: handleEvents,
},
{
Name: "env",
Usage: "Dump state of the chain that is used for VM CLI invocations (use -v for verbose node configuration)",
Usage: "dump state of the chain that is used for VM CLI invocations (use -v for verbose node configuration)",
UsageText: `env [-v]`,
Flags: []cli.Flag{
cli.BoolFlag{
Name: verboseFlagFullName + ",v",
Usage: "Print the whole blockchain node configuration.",
Usage: "print the whole blockchain node configuration.",
},
},
Description: `Dump state of the chain that is used for VM CLI invocations (use -v for verbose node configuration).
@ -352,16 +352,16 @@ Example:
},
{
Name: "storage",
Usage: "Dump storage of the contract with the specified hash, address or ID as is at the current stage of script invocation",
Usage: "dump storage of the contract with the specified hash, address or ID as is at the current stage of script invocation",
UsageText: `storage <hash-or-address-or-id> [<prefix>] [--backwards] [--diff]`,
Flags: []cli.Flag{
cli.BoolFlag{
Name: backwardsFlagFullName + ",b",
Usage: "Backwards traversal direction",
Usage: "backwards traversal direction",
},
cli.BoolFlag{
Name: diffFlagFullName + ",d",
Usage: "Dump only those storage items that were added or changed during the current script invocation. Note that this call won't show removed storage items, use 'changes' command for that.",
Usage: "dump only those storage items that were added or changed during the current script invocation. Note that this call won't show removed storage items, use 'changes' command for that.",
},
},
Description: `Dump storage of the contract with the specified hash, address or ID as is at the current stage of script invocation.
@ -378,7 +378,7 @@ Example:
},
{
Name: "changes",
Usage: "Dump storage changes as is at the current stage of loaded script invocation",
Usage: "dump storage changes as is at the current stage of loaded script invocation",
UsageText: `changes [<hash-or-address-or-id> [<prefix>]]`,
Description: `Dump storage changes as is at the current stage of loaded script invocation.
If no script is loaded or executed, then no changes are present.

View file

@ -26,7 +26,7 @@ func newNEP11Commands() []cli.Command {
maxIters := strconv.Itoa(config.DefaultMaxIteratorResultItems)
tokenAddressFlag := flags.AddressFlag{
Name: "token",
Usage: "Token contract address or hash in LE",
Usage: "token contract address or hash in LE",
}
ownerAddressFlag := flags.AddressFlag{
Name: "address",

View file

@ -41,7 +41,7 @@ type transferTarget struct {
var (
tokenFlag = cli.StringFlag{
Name: "token",
Usage: "Token to use (hash or name (for NEO/GAS or imported tokens))",
Usage: "token to use (hash or name (for NEO/GAS or imported tokens))",
}
baseBalanceFlags = []cli.Flag{
walletPathFlag,
@ -49,7 +49,7 @@ var (
tokenFlag,
flags.AddressFlag{
Name: "address, a",
Usage: "Address to use",
Usage: "address to use",
},
}
importFlags = append([]cli.Flag{
@ -57,7 +57,7 @@ var (
walletConfigFlag,
flags.AddressFlag{
Name: "token",
Usage: "Token contract address or hash in LE",
Usage: "token contract address or hash in LE",
},
}, options.RPC...)
baseTransferFlags = []cli.Flag{
@ -73,7 +73,7 @@ var (
txctx.AwaitFlag,
cli.StringFlag{
Name: "amount",
Usage: "Amount of asset to send",
Usage: "amount of asset to send",
},
}
multiTransferFlags = append([]cli.Flag{

View file

@ -32,7 +32,7 @@ func newValidatorCommands() []cli.Command {
txctx.AwaitFlag,
flags.AddressFlag{
Name: "address, a",
Usage: "Address to register",
Usage: "address to register",
},
}, options.RPC...),
},

View file

@ -49,11 +49,11 @@ var (
var (
walletPathFlag = cli.StringFlag{
Name: "wallet, w",
Usage: "Path to the wallet file ('-' to read from stdin); conflicts with --wallet-config flag.",
Usage: "path to the wallet file ('-' to read from stdin); conflicts with --wallet-config flag.",
}
walletConfigFlag = cli.StringFlag{
Name: "wallet-config",
Usage: "Path to the wallet config file; conflicts with --wallet flag.",
Usage: "path to the wallet config file; conflicts with --wallet flag.",
}
wifFlag = cli.StringFlag{
Name: "wif",
@ -61,7 +61,7 @@ var (
}
decryptFlag = cli.BoolFlag{
Name: "decrypt, d",
Usage: "Decrypt encrypted keys.",
Usage: "decrypt encrypted keys.",
}
inFlag = cli.StringFlag{
Name: "in",
@ -69,11 +69,11 @@ var (
}
fromAddrFlag = flags.AddressFlag{
Name: "from",
Usage: "Address to send an asset from",
Usage: "address to send an asset from",
}
toAddrFlag = flags.AddressFlag{
Name: "to",
Usage: "Address to send an asset to",
Usage: "address to send an asset to",
}
)
@ -89,7 +89,7 @@ func NewCommands() []cli.Command {
txctx.AwaitFlag,
flags.AddressFlag{
Name: "address, a",
Usage: "Address to claim GAS for",
Usage: "address to claim GAS for",
},
}
claimFlags = append(claimFlags, options.RPC...)
@ -101,7 +101,7 @@ func NewCommands() []cli.Command {
inFlag,
flags.AddressFlag{
Name: "address, a",
Usage: "Address to use",
Usage: "address to use",
},
}
signFlags = append(signFlags, options.RPC...)
@ -126,7 +126,7 @@ func NewCommands() []cli.Command {
walletConfigFlag,
cli.BoolFlag{
Name: "account, a",
Usage: "Create a new account",
Usage: "create a new account",
},
},
},
@ -225,11 +225,11 @@ func NewCommands() []cli.Command {
wifFlag,
cli.StringFlag{
Name: "name, n",
Usage: "Optional account name",
Usage: "optional account name",
},
cli.StringFlag{
Name: "contract",
Usage: "Verification script for custom contracts",
Usage: "verification script for custom contracts",
},
},
},
@ -252,11 +252,11 @@ func NewCommands() []cli.Command {
wifFlag,
cli.StringFlag{
Name: "name, n",
Usage: "Optional account name",
Usage: "optional account name",
},
cli.IntFlag{
Name: "min, m",
Usage: "Minimal number of signatures",
Usage: "minimal number of signatures",
},
},
},
@ -271,11 +271,11 @@ func NewCommands() []cli.Command {
wifFlag,
cli.StringFlag{
Name: "name, n",
Usage: "Optional account name",
Usage: "optional account name",
},
flags.AddressFlag{
Name: "contract, c",
Usage: "Contract hash or address",
Usage: "contract hash or address",
},
}, options.RPC...),
},
@ -290,7 +290,7 @@ func NewCommands() []cli.Command {
txctx.ForceFlag,
flags.AddressFlag{
Name: "address, a",
Usage: "Account address or hash in LE form to be removed",
Usage: "account address or hash in LE form to be removed",
},
},
},