From 0fe705605e4610e1b2b2ee2e4fe709f85c4def50 Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 2 Apr 2021 19:24:15 +0800 Subject: [PATCH 1/3] fix 4857: show help for set-addrs --- cmd/lotus-storage-miner/actor.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/lotus-storage-miner/actor.go b/cmd/lotus-storage-miner/actor.go index 8c2ab95bd71..94ccb08463e 100644 --- a/cmd/lotus-storage-miner/actor.go +++ b/cmd/lotus-storage-miner/actor.go @@ -55,6 +55,11 @@ var actorSetAddrsCmd = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { + args := cctx.Args().Slice() + if len(args) == 0 { + return cli.ShowSubcommandHelp(cctx) + } + nodeAPI, closer, err := lcli.GetStorageMinerAPI(cctx) if err != nil { return err @@ -70,7 +75,10 @@ var actorSetAddrsCmd = &cli.Command{ ctx := lcli.ReqContext(cctx) var addrs []abi.Multiaddrs - for _, a := range cctx.Args().Slice() { + for _, a := range args { + if a == "nil" { + continue + } maddr, err := ma.NewMultiaddr(a) if err != nil { return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err) From 44031586807a9712c194995df41e20fc0a996886 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 6 Apr 2021 11:24:32 +0800 Subject: [PATCH 2/3] add unset for set-addrs --- cmd/lotus-storage-miner/actor.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/lotus-storage-miner/actor.go b/cmd/lotus-storage-miner/actor.go index 94ccb08463e..4897c28ded3 100644 --- a/cmd/lotus-storage-miner/actor.go +++ b/cmd/lotus-storage-miner/actor.go @@ -53,12 +53,21 @@ var actorSetAddrsCmd = &cli.Command{ Usage: "set gas limit", Value: 0, }, + &cli.BoolFlag{ + Name: "unset", + Usage: "unset address", + Value: false, + }, }, Action: func(cctx *cli.Context) error { args := cctx.Args().Slice() - if len(args) == 0 { + unset := cctx.Bool("unset") + if len(args) == 0 && !unset { return cli.ShowSubcommandHelp(cctx) } + if len(args) > 0 && unset { + return fmt.Errorf("unset should with no arguments") + } nodeAPI, closer, err := lcli.GetStorageMinerAPI(cctx) if err != nil { @@ -76,9 +85,6 @@ var actorSetAddrsCmd = &cli.Command{ var addrs []abi.Multiaddrs for _, a := range args { - if a == "nil" { - continue - } maddr, err := ma.NewMultiaddr(a) if err != nil { return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err) From 2dbd597f82fd5bcb00297de25b7871a3f6a1fe59 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 8 Apr 2021 11:14:53 +0800 Subject: [PATCH 3/3] Update cmd/lotus-storage-miner/actor.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ɓukasz Magiera --- cmd/lotus-storage-miner/actor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/lotus-storage-miner/actor.go b/cmd/lotus-storage-miner/actor.go index 4897c28ded3..7e428d0e4af 100644 --- a/cmd/lotus-storage-miner/actor.go +++ b/cmd/lotus-storage-miner/actor.go @@ -66,7 +66,7 @@ var actorSetAddrsCmd = &cli.Command{ return cli.ShowSubcommandHelp(cctx) } if len(args) > 0 && unset { - return fmt.Errorf("unset should with no arguments") + return fmt.Errorf("unset can only be used with no arguments") } nodeAPI, closer, err := lcli.GetStorageMinerAPI(cctx)