cli: use '--address' instead of '--addr' and allow '-a' everywhere

This commit is contained in:
Roman Khimov 2020-09-28 18:43:53 +03:00
parent fdcc72dad0
commit eff5f10579
4 changed files with 9 additions and 9 deletions

View file

@ -74,7 +74,7 @@ func TestSignMultisigTx(t *testing.T) {
e.In.WriteString("pass\r") e.In.WriteString("pass\r")
e.Run(t, "neo-go", "wallet", "multisig", "sign", e.Run(t, "neo-go", "wallet", "multisig", "sign",
"--unittest", "--rpc-endpoint", "http://"+e.RPC.Addr, "--unittest", "--rpc-endpoint", "http://"+e.RPC.Addr,
"--wallet", wallet2Path, "--addr", multisigAddr, "--wallet", wallet2Path, "--address", multisigAddr,
"--in", txPath, "--out", txPath) "--in", txPath, "--out", txPath)
e.checkTxPersisted(t) e.checkTxPersisted(t)

View file

@ -24,7 +24,7 @@ func TestNEP5Balance(t *testing.T) {
"--rpc-endpoint", "http://"+e.RPC.Addr, "--rpc-endpoint", "http://"+e.RPC.Addr,
"--wallet", validatorWallet, "--wallet", validatorWallet,
) )
cmd := append(cmdbase, "--addr", validatorAddr) cmd := append(cmdbase, "--address", validatorAddr)
t.Run("NEO", func(t *testing.T) { t.Run("NEO", func(t *testing.T) {
b, index := e.Chain.GetGoverningTokenBalance(validatorHash) b, index := e.Chain.GetGoverningTokenBalance(validatorHash)
checkResult := func(t *testing.T) { checkResult := func(t *testing.T) {
@ -95,7 +95,7 @@ func TestNEP5Balance(t *testing.T) {
e.RunWithError(t, append(cmdbalance, "--wallet", "/dev/null")...) e.RunWithError(t, append(cmdbalance, "--wallet", "/dev/null")...)
}) })
t.Run("Bad address", func(t *testing.T) { t.Run("Bad address", func(t *testing.T) {
e.RunWithError(t, append(cmdbalance, "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", validatorWallet, "--addr", "xxx")...) e.RunWithError(t, append(cmdbalance, "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", validatorWallet, "--address", "xxx")...)
}) })
return return
} }

View file

@ -18,7 +18,7 @@ func newMultisigCommands() []cli.Command {
outFlag, outFlag,
inFlag, inFlag,
cli.StringFlag{ cli.StringFlag{
Name: "addr", Name: "address, a",
Usage: "Address to use", Usage: "Address to use",
}, },
} }
@ -27,7 +27,7 @@ func newMultisigCommands() []cli.Command {
{ {
Name: "sign", Name: "sign",
Usage: "sign a transaction", Usage: "sign a transaction",
UsageText: "multisig sign --wallet <path> --addr <addr> --in <file.in> --out <file.out>", UsageText: "multisig sign --wallet <path> --address <address> --in <file.in> --out <file.out>",
Action: signMultisig, Action: signMultisig,
Flags: signFlags, Flags: signFlags,
}, },
@ -45,7 +45,7 @@ func signMultisig(ctx *cli.Context) error {
if err != nil { if err != nil {
return cli.NewExitError(err, 1) return cli.NewExitError(err, 1)
} }
addr := ctx.String("addr") addr := ctx.String("address")
sh, err := address.StringToUint160(addr) sh, err := address.StringToUint160(addr)
if err != nil { if err != nil {
return cli.NewExitError(fmt.Errorf("invalid address: %w", err), 1) return cli.NewExitError(fmt.Errorf("invalid address: %w", err), 1)

View file

@ -41,7 +41,7 @@ func newNEP5Commands() []cli.Command {
walletPathFlag, walletPathFlag,
tokenFlag, tokenFlag,
cli.StringFlag{ cli.StringFlag{
Name: "addr", Name: "address, a",
Usage: "Address to use", Usage: "Address to use",
}, },
} }
@ -78,7 +78,7 @@ func newNEP5Commands() []cli.Command {
{ {
Name: "balance", Name: "balance",
Usage: "get address balance", Usage: "get address balance",
UsageText: "balance --wallet <path> --rpc-endpoint <node> [--timeout <time>] [--addr <addr>] [--token <hash-or-name>]", UsageText: "balance --wallet <path> --rpc-endpoint <node> [--timeout <time>] [--address <address>] [--token <hash-or-name>]",
Action: getNEP5Balance, Action: getNEP5Balance,
Flags: balanceFlags, Flags: balanceFlags,
}, },
@ -143,7 +143,7 @@ func getNEP5Balance(ctx *cli.Context) error {
} }
defer wall.Close() defer wall.Close()
addr := ctx.String("addr") addr := ctx.String("address")
if addr != "" { if addr != "" {
addrHash, err := address.StringToUint160(addr) addrHash, err := address.StringToUint160(addr)
if err != nil { if err != nil {