cctx.Args().Len() to cctx.NArg()
This commit is contained in:
parent
f567db64b6
commit
308cef950b
@ -114,7 +114,7 @@ this command must be within this base path`,
|
||||
},
|
||||
ArgsUsage: "[backup file path]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("expected 1 argument")
|
||||
}
|
||||
|
||||
|
@ -946,7 +946,7 @@ var ChainBisectCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() < 4 {
|
||||
if cctx.NArg() < 4 {
|
||||
return xerrors.New("need at least 4 args")
|
||||
}
|
||||
|
||||
@ -1312,7 +1312,7 @@ var chainDecodeParamsCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return ShowHelp(cctx, fmt.Errorf("incorrect number of arguments"))
|
||||
}
|
||||
|
||||
@ -1391,7 +1391,7 @@ var chainEncodeParamsCmd = &cli.Command{
|
||||
Action: func(cctx *cli.Context) error {
|
||||
afmt := NewAppFmt(cctx.App)
|
||||
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return ShowHelp(cctx, fmt.Errorf("incorrect number of arguments"))
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ var clientCommPCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("usage: commP <inputPath>")
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ var clientCarGenCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return fmt.Errorf("usage: generate-car <inputPath> <outputPath>")
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ var filplusVerifyClientCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return fmt.Errorf("must specify two arguments: address and allowance")
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ var filplusSignRemoveDataCapProposal = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return fmt.Errorf("must specify three arguments: notary address, client address, and allowance to remove")
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ var MpoolReplaceCmd = &cli.Command{
|
||||
|
||||
var from address.Address
|
||||
var nonce uint64
|
||||
switch cctx.Args().Len() {
|
||||
switch cctx.NArg() {
|
||||
case 1:
|
||||
mcid, err := cid.Decode(cctx.Args().First())
|
||||
if err != nil {
|
||||
@ -610,7 +610,7 @@ var MpoolConfig = &cli.Command{
|
||||
Usage: "get or set current mpool configuration",
|
||||
ArgsUsage: "[new-config]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() > 1 {
|
||||
if cctx.NArg() > 1 {
|
||||
return cli.ShowCommandHelp(cctx, cctx.Command.Name)
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ var MpoolConfig = &cli.Command{
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() == 0 {
|
||||
if cctx.NArg() == 0 {
|
||||
cfg, err := api.MpoolGetConfig(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -88,7 +88,7 @@ var msigCreateCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 1 {
|
||||
if cctx.NArg() < 1 {
|
||||
return ShowHelp(cctx, fmt.Errorf("multisigs must have at least one signer"))
|
||||
}
|
||||
|
||||
@ -365,11 +365,11 @@ var msigProposeCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 3 {
|
||||
if cctx.NArg() < 3 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass at least multisig address, destination, and value"))
|
||||
}
|
||||
|
||||
if cctx.Args().Len() > 3 && cctx.Args().Len() != 5 {
|
||||
if cctx.NArg() > 3 && cctx.NArg() != 5 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must either pass three or five arguments"))
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ var msigProposeCmd = &cli.Command{
|
||||
|
||||
var method uint64
|
||||
var params []byte
|
||||
if cctx.Args().Len() == 5 {
|
||||
if cctx.NArg() == 5 {
|
||||
m, err := strconv.ParseUint(cctx.Args().Get(3), 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -487,15 +487,15 @@ var msigApproveCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 2 {
|
||||
if cctx.NArg() < 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass at least multisig address and message ID"))
|
||||
}
|
||||
|
||||
if cctx.Args().Len() > 2 && cctx.Args().Len() < 5 {
|
||||
if cctx.NArg() > 2 && cctx.NArg() < 5 {
|
||||
return ShowHelp(cctx, fmt.Errorf("usage: msig approve <msig addr> <message ID> <proposer address> <desination> <value>"))
|
||||
}
|
||||
|
||||
if cctx.Args().Len() > 5 && cctx.Args().Len() != 7 {
|
||||
if cctx.NArg() > 5 && cctx.NArg() != 7 {
|
||||
return ShowHelp(cctx, fmt.Errorf("usage: msig approve <msig addr> <message ID> <proposer address> <desination> <value> [ <method> <params> ]"))
|
||||
}
|
||||
|
||||
@ -534,7 +534,7 @@ var msigApproveCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var msgCid cid.Cid
|
||||
if cctx.Args().Len() == 2 {
|
||||
if cctx.NArg() == 2 {
|
||||
proto, err := api.MsigApprove(ctx, msig, txid, from)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -571,7 +571,7 @@ var msigApproveCmd = &cli.Command{
|
||||
|
||||
var method uint64
|
||||
var params []byte
|
||||
if cctx.Args().Len() == 7 {
|
||||
if cctx.NArg() == 7 {
|
||||
m, err := strconv.ParseUint(cctx.Args().Get(5), 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -624,15 +624,15 @@ var msigCancelCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 2 {
|
||||
if cctx.NArg() < 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass at least multisig address and message ID"))
|
||||
}
|
||||
|
||||
if cctx.Args().Len() > 2 && cctx.Args().Len() < 4 {
|
||||
if cctx.NArg() > 2 && cctx.NArg() < 4 {
|
||||
return ShowHelp(cctx, fmt.Errorf("usage: msig cancel <msig addr> <message ID> <desination> <value>"))
|
||||
}
|
||||
|
||||
if cctx.Args().Len() > 4 && cctx.Args().Len() != 6 {
|
||||
if cctx.NArg() > 4 && cctx.NArg() != 6 {
|
||||
return ShowHelp(cctx, fmt.Errorf("usage: msig cancel <msig addr> <message ID> <desination> <value> [ <method> <params> ]"))
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ var msigCancelCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var msgCid cid.Cid
|
||||
if cctx.Args().Len() == 2 {
|
||||
if cctx.NArg() == 2 {
|
||||
proto, err := api.MsigCancel(ctx, msig, txid, from)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -696,7 +696,7 @@ var msigCancelCmd = &cli.Command{
|
||||
|
||||
var method uint64
|
||||
var params []byte
|
||||
if cctx.Args().Len() == 6 {
|
||||
if cctx.NArg() == 6 {
|
||||
m, err := strconv.ParseUint(cctx.Args().Get(4), 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -753,7 +753,7 @@ var msigRemoveProposeCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address and signer address"))
|
||||
}
|
||||
|
||||
@ -840,7 +840,7 @@ var msigAddProposeCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address and signer address"))
|
||||
}
|
||||
|
||||
@ -949,7 +949,7 @@ var msigAddApproveCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 5 {
|
||||
if cctx.NArg() != 5 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, proposer address, transaction id, new signer address, whether to increase threshold"))
|
||||
}
|
||||
|
||||
@ -1040,7 +1040,7 @@ var msigAddCancelCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 4 {
|
||||
if cctx.NArg() != 4 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, transaction id, new signer address, whether to increase threshold"))
|
||||
}
|
||||
|
||||
@ -1126,7 +1126,7 @@ var msigSwapProposeCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, old signer address, new signer address"))
|
||||
}
|
||||
|
||||
@ -1207,7 +1207,7 @@ var msigSwapApproveCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 5 {
|
||||
if cctx.NArg() != 5 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, proposer address, transaction id, old signer address, new signer address"))
|
||||
}
|
||||
|
||||
@ -1298,7 +1298,7 @@ var msigSwapCancelCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 4 {
|
||||
if cctx.NArg() != 4 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, transaction id, old signer address, new signer address"))
|
||||
}
|
||||
|
||||
@ -1384,7 +1384,7 @@ var msigLockProposeCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 4 {
|
||||
if cctx.NArg() != 4 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, start epoch, unlock duration, and amount"))
|
||||
}
|
||||
|
||||
@ -1480,7 +1480,7 @@ var msigLockApproveCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 6 {
|
||||
if cctx.NArg() != 6 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, proposer address, tx id, start epoch, unlock duration, and amount"))
|
||||
}
|
||||
|
||||
@ -1586,7 +1586,7 @@ var msigLockCancelCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 5 {
|
||||
if cctx.NArg() != 5 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address, tx id, start epoch, unlock duration, and amount"))
|
||||
}
|
||||
|
||||
@ -1693,7 +1693,7 @@ var msigVestedCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address"))
|
||||
}
|
||||
|
||||
@ -1749,7 +1749,7 @@ var msigProposeThresholdCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass multisig address and new threshold value"))
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ var NetPing = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("please provide a peerID")
|
||||
}
|
||||
|
||||
|
22
cli/paych.go
22
cli/paych.go
@ -50,7 +50,7 @@ var paychAddFundsCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass three arguments: <from> <to> <available funds>"))
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ var paychStatusByFromToCmd = &cli.Command{
|
||||
Usage: "Show the status of an active outbound payment channel by from/to addresses",
|
||||
ArgsUsage: "[fromAddress toAddress]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass two arguments: <from address> <to address>"))
|
||||
}
|
||||
ctx := ReqContext(cctx)
|
||||
@ -148,7 +148,7 @@ var paychStatusCmd = &cli.Command{
|
||||
Usage: "Show the status of an outbound payment channel",
|
||||
ArgsUsage: "[channelAddress]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass an argument: <channel address>"))
|
||||
}
|
||||
ctx := ReqContext(cctx)
|
||||
@ -260,7 +260,7 @@ var paychSettleCmd = &cli.Command{
|
||||
Usage: "Settle a payment channel",
|
||||
ArgsUsage: "[channelAddress]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must pass payment channel address")
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ var paychCloseCmd = &cli.Command{
|
||||
Usage: "Collect funds for a payment channel",
|
||||
ArgsUsage: "[channelAddress]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must pass payment channel address")
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ var paychVoucherCreateCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass two arguments: <channel> <amount>"))
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ var paychVoucherCheckCmd = &cli.Command{
|
||||
Usage: "Check validity of payment channel voucher",
|
||||
ArgsUsage: "[channelAddress voucher]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass payment channel address and voucher to validate"))
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ var paychVoucherAddCmd = &cli.Command{
|
||||
Usage: "Add payment channel voucher to local datastore",
|
||||
ArgsUsage: "[channelAddress voucher]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass payment channel address and voucher"))
|
||||
}
|
||||
|
||||
@ -486,7 +486,7 @@ var paychVoucherListCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass payment channel address"))
|
||||
}
|
||||
|
||||
@ -531,7 +531,7 @@ var paychVoucherBestSpendableCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass payment channel address"))
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ var paychVoucherSubmitCmd = &cli.Command{
|
||||
Usage: "Submit voucher to chain to update payment channel state",
|
||||
ArgsUsage: "[channelAddress voucher]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("must pass payment channel address and voucher"))
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ var sendCmd = &cli.Command{
|
||||
fmt.Println("'force' flag is deprecated, use global flag 'force-send'")
|
||||
}
|
||||
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return ShowHelp(cctx, fmt.Errorf("'send' expects two arguments, target and amount"))
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ var StateReplayCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
fmt.Println("must provide cid of message to replay")
|
||||
return nil
|
||||
}
|
||||
@ -1580,7 +1580,7 @@ var StateCallCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 2 {
|
||||
if cctx.NArg() < 2 {
|
||||
return fmt.Errorf("must specify at least actor and method to invoke")
|
||||
}
|
||||
|
||||
@ -1619,7 +1619,7 @@ var StateCallCmd = &cli.Command{
|
||||
|
||||
var params []byte
|
||||
// If params were passed in, decode them
|
||||
if cctx.Args().Len() > 2 {
|
||||
if cctx.NArg() > 2 {
|
||||
switch cctx.String("encoding") {
|
||||
case "base64":
|
||||
params, err = base64.StdEncoding.DecodeString(cctx.Args().Get(2))
|
||||
@ -1743,7 +1743,7 @@ var StateSectorCmd = &cli.Command{
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return xerrors.Errorf("expected 2 params: minerAddress and sectorNumber")
|
||||
}
|
||||
|
||||
|
@ -959,7 +959,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
|
||||
}
|
||||
|
||||
func ParsePieceInfos(cctx *cli.Context, firstArg int) ([]abi.PieceInfo, error) {
|
||||
args := cctx.Args().Len() - firstArg
|
||||
args := cctx.NArg() - firstArg
|
||||
if args%2 != 0 {
|
||||
return nil, xerrors.Errorf("piece info argunemts need to be supplied in pairs")
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ var restoreCmd = &cli.Command{
|
||||
}
|
||||
|
||||
func restore(ctx context.Context, cctx *cli.Context, targetPath string, strConfig *paths.StorageConfig, manageConfig func(*config.StorageMiner) error, after func(api lapi.FullNode, addr address.Address, peerid peer.ID, mi api.MinerInfo) error) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("expected 1 argument")
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ var dealsImportDataCmd = &cli.Command{
|
||||
|
||||
ctx := lcli.DaemonContext(cctx)
|
||||
|
||||
if cctx.Args().Len() < 2 {
|
||||
if cctx.NArg() < 2 {
|
||||
return fmt.Errorf("must specify proposal CID and file path")
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ var setSealDurationCmd = &cli.Command{
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass duration in minutes")
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ var provingDeadlineInfoCmd = &cli.Command{
|
||||
ArgsUsage: "<deadlineIdx>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass deadline index")
|
||||
}
|
||||
|
||||
@ -461,7 +461,7 @@ var provingCheckProvableCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass deadline index")
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ var provingComputeWindowPoStCmd = &cli.Command{
|
||||
It will not send any messages to the chain.`,
|
||||
ArgsUsage: "[deadline index]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass deadline index")
|
||||
}
|
||||
|
||||
@ -661,7 +661,7 @@ var provingRecoverFaultsCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 1 {
|
||||
if cctx.NArg() < 1 {
|
||||
return xerrors.Errorf("must pass at least 1 sector number")
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ var sealingAbortCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("expected 1 argument")
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ var sealingDataCidCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 1 || cctx.Args().Len() > 2 {
|
||||
if cctx.NArg() < 1 || cctx.NArg() > 2 {
|
||||
return xerrors.Errorf("expected 1 or 2 arguments")
|
||||
}
|
||||
|
||||
@ -484,7 +484,7 @@ var sealingDataCidCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var psize abi.PaddedPieceSize
|
||||
if cctx.Args().Len() == 2 {
|
||||
if cctx.NArg() == 2 {
|
||||
rps, err := humanize.ParseBytes(cctx.Args().Get(1))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("parsing piece size: %w", err)
|
||||
|
@ -1378,7 +1378,7 @@ var sectorsTerminateCmd = &cli.Command{
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass sector number")
|
||||
}
|
||||
|
||||
@ -1488,7 +1488,7 @@ var sectorsRemoveCmd = &cli.Command{
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass sector number")
|
||||
}
|
||||
|
||||
@ -1506,7 +1506,7 @@ var sectorsSnapUpCmd = &cli.Command{
|
||||
Usage: "Mark a committed capacity sector to be filled with deals",
|
||||
ArgsUsage: "<sectorNum>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return lcli.ShowHelp(cctx, xerrors.Errorf("must pass sector number"))
|
||||
}
|
||||
|
||||
@ -1550,7 +1550,7 @@ var sectorsSnapAbortCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return lcli.ShowHelp(cctx, xerrors.Errorf("must pass sector number"))
|
||||
}
|
||||
|
||||
@ -1587,7 +1587,7 @@ var sectorsStartSealCmd = &cli.Command{
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass sector number")
|
||||
}
|
||||
|
||||
@ -1611,7 +1611,7 @@ var sectorsSealDelayCmd = &cli.Command{
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("must pass duration in minutes")
|
||||
}
|
||||
|
||||
@ -1714,7 +1714,7 @@ var sectorsUpdateCmd = &cli.Command{
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
if cctx.Args().Len() < 2 {
|
||||
if cctx.NArg() < 2 {
|
||||
return xerrors.Errorf("must pass sector number and new state")
|
||||
}
|
||||
|
||||
@ -2310,7 +2310,7 @@ var sectorsNumbersReserveCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return xerrors.Errorf("expected 2 arguments: [reservation name] [reserved ranges]")
|
||||
}
|
||||
|
||||
@ -2335,7 +2335,7 @@ var sectorsNumbersFreeCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("expected 1 argument: [reservation name]")
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ var genesisAddMinerCmd = &cli.Command{
|
||||
Description: "add genesis miner",
|
||||
Flags: []cli.Flag{},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return xerrors.New("seed genesis add-miner [genesis.json] [preseal.json]")
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ type GenAccountEntry struct {
|
||||
var genesisAddMsigsCmd = &cli.Command{
|
||||
Name: "add-msigs",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 2 {
|
||||
if cctx.NArg() < 2 {
|
||||
return fmt.Errorf("must specify template file and csv file with accounts")
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ var genesisSetVRKCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must specify template file")
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ var genesisSetRemainderCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must specify template file")
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ var genesisSetActorVersionCmd = &cli.Command{
|
||||
},
|
||||
ArgsUsage: "<genesisFile>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must specify genesis file")
|
||||
}
|
||||
|
||||
@ -597,7 +597,7 @@ var genesisSetVRKSignersCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must specify template file")
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ var base16Cmd = &cli.Command{
|
||||
Action: func(cctx *cli.Context) error {
|
||||
var input io.Reader
|
||||
|
||||
if cctx.Args().Len() == 0 {
|
||||
if cctx.NArg() == 0 {
|
||||
input = os.Stdin
|
||||
} else {
|
||||
input = strings.NewReader(cctx.Args().First())
|
||||
|
@ -24,7 +24,7 @@ var base32Cmd = &cli.Command{
|
||||
Action: func(cctx *cli.Context) error {
|
||||
var input io.Reader
|
||||
|
||||
if cctx.Args().Len() == 0 {
|
||||
if cctx.NArg() == 0 {
|
||||
input = os.Stdin
|
||||
} else {
|
||||
input = strings.NewReader(cctx.Args().First())
|
||||
|
@ -32,7 +32,7 @@ var base64Cmd = &cli.Command{
|
||||
Action: func(cctx *cli.Context) error {
|
||||
var input io.Reader
|
||||
|
||||
if cctx.Args().Len() == 0 {
|
||||
if cctx.NArg() == 0 {
|
||||
input = os.Stdin
|
||||
} else {
|
||||
input = strings.NewReader(cctx.Args().First())
|
||||
|
@ -84,7 +84,7 @@ var consensusCheckCmd = &cli.Command{
|
||||
filePath := cctx.Args().First()
|
||||
|
||||
var input *bufio.Reader
|
||||
if cctx.Args().Len() == 0 {
|
||||
if cctx.NArg() == 0 {
|
||||
input = bufio.NewReader(os.Stdin)
|
||||
} else {
|
||||
var err error
|
||||
|
@ -171,7 +171,7 @@ var datastoreBackupStatCmd = &cli.Command{
|
||||
Description: "validate and print info about datastore backup",
|
||||
ArgsUsage: "[file]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("expected 1 argument")
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ var datastoreBackupListCmd = &cli.Command{
|
||||
},
|
||||
ArgsUsage: "[file]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("expected 1 argument")
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ var exportCarCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return lcli.ShowHelp(cctx, fmt.Errorf("must specify file name and object"))
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ var keyinfoImportCmd = &cli.Command{
|
||||
flagRepo := cctx.String("repo")
|
||||
|
||||
var input io.Reader
|
||||
if cctx.Args().Len() == 0 {
|
||||
if cctx.NArg() == 0 {
|
||||
input = os.Stdin
|
||||
} else {
|
||||
var err error
|
||||
@ -261,7 +261,7 @@ var keyinfoInfoCmd = &cli.Command{
|
||||
format := cctx.String("format")
|
||||
|
||||
var input io.Reader
|
||||
if cctx.Args().Len() == 0 {
|
||||
if cctx.NArg() == 0 {
|
||||
input = os.Stdin
|
||||
} else {
|
||||
var err error
|
||||
|
@ -135,7 +135,7 @@ var minerCreateCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() != 4 {
|
||||
if cctx.NArg() != 4 {
|
||||
return xerrors.Errorf("expected 4 args (sender owner worker sectorSize)")
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ var minerUnpackInfoCmd = &cli.Command{
|
||||
Usage: "unpack miner info all dump",
|
||||
ArgsUsage: "[allinfo.txt] [dir]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return xerrors.Errorf("expected 2 args")
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ var msgCmd = &cli.Command{
|
||||
Usage: "Translate message between various formats",
|
||||
ArgsUsage: "Message in any form",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("expected 1 argument")
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ var verifySealProofCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return fmt.Errorf("must specify commR, commD, and proof to verify")
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ var rpcCmd = &cli.Command{
|
||||
}
|
||||
|
||||
if cctx.Args().Present() {
|
||||
if cctx.Args().Len() > 2 {
|
||||
if cctx.NArg() > 2 {
|
||||
return xerrors.Errorf("expected 1 or 2 arguments: method [params]")
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ var terminateSectorCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 1 {
|
||||
if cctx.NArg() < 1 {
|
||||
return fmt.Errorf("at least one sector must be specified")
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ var terminateSectorPenaltyEstimationCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 1 {
|
||||
if cctx.NArg() < 1 {
|
||||
return fmt.Errorf("at least one sector must be specified")
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ var sigsVerifyBlsMsgsCmd = &cli.Command{
|
||||
Description: "given a block, verifies the bls signature of the messages in the block",
|
||||
Usage: "<blockCid>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 1 {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.Errorf("usage: <blockCid>")
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ var sigsVerifyVoteCmd = &cli.Command{
|
||||
Usage: "<FIPnumber> <signingAddress> <signature>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return xerrors.Errorf("usage: verify-vote <FIPnumber> <signingAddress> <signature>")
|
||||
}
|
||||
|
||||
|
@ -174,8 +174,8 @@ var staterootStatCmd = &cli.Command{
|
||||
}
|
||||
|
||||
outcap := 10
|
||||
if cctx.Args().Len() > outcap {
|
||||
outcap = cctx.Args().Len()
|
||||
if cctx.NArg() > outcap {
|
||||
outcap = cctx.NArg()
|
||||
}
|
||||
if len(infos) < outcap {
|
||||
outcap = len(infos)
|
||||
|
@ -38,7 +38,7 @@ var syncValidateCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() < 1 {
|
||||
if cctx.NArg() < 1 {
|
||||
fmt.Println("usage: <blockCid1> <blockCid2>...")
|
||||
fmt.Println("At least one block cid must be provided")
|
||||
return nil
|
||||
@ -75,7 +75,7 @@ var syncScrapePowerCmd = &cli.Command{
|
||||
Usage: "given a height and a tipset, reports what percentage of mining power had a winning ticket between the tipset and height",
|
||||
ArgsUsage: "[height tipsetkey]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() < 1 {
|
||||
if cctx.NArg() < 1 {
|
||||
fmt.Println("usage: <height> [blockCid1 blockCid2...]")
|
||||
fmt.Println("Any CIDs passed after the height will be used as the tipset key")
|
||||
fmt.Println("If no block CIDs are provided, chain head will be used")
|
||||
@ -90,7 +90,7 @@ var syncScrapePowerCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
if cctx.Args().Len() < 1 {
|
||||
if cctx.NArg() < 1 {
|
||||
fmt.Println("usage: <blockCid1> <blockCid2>...")
|
||||
fmt.Println("At least one block cid must be provided")
|
||||
return nil
|
||||
|
@ -46,7 +46,7 @@ var verifRegAddVerifierFromMsigCmd = &cli.Command{
|
||||
Usage: "make a given account a verifier",
|
||||
ArgsUsage: "<message sender> <new verifier> <allowance>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return fmt.Errorf("must specify three arguments: sender, verifier, and allowance")
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ var verifRegAddVerifierFromAccountCmd = &cli.Command{
|
||||
Usage: "make a given account a verifier",
|
||||
ArgsUsage: "<verifier root key> <new verifier> <allowance>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 3 {
|
||||
if cctx.NArg() != 3 {
|
||||
return fmt.Errorf("must specify three arguments: sender, verifier, and allowance")
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ var verifRegVerifyClientCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if cctx.Args().Len() != 2 {
|
||||
if cctx.NArg() != 2 {
|
||||
return fmt.Errorf("must specify two arguments: address and allowance")
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ var verifRegRemoveVerifiedClientDataCapCmd = &cli.Command{
|
||||
Usage: "Remove data cap from verified client",
|
||||
ArgsUsage: "<message sender> <client address> <allowance to remove> <verifier 1 address> <verifier 1 signature> <verifier 2 address> <verifier 2 signature>",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 7 {
|
||||
if cctx.NArg() != 7 {
|
||||
return fmt.Errorf("must specify seven arguments: sender, client, allowance to remove, verifier 1 address, verifier 1 signature, verifier 2 address, verifier 2 signature")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user