diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index 9bfc84900e3..43a71fd9ef0 100644 --- a/cmd/lotus-miner/sectors.go +++ b/cmd/lotus-miner/sectors.go @@ -266,8 +266,9 @@ var sectorsListCmd = &cli.Command{ Usage: "List sectors", Flags: []cli.Flag{ &cli.BoolFlag{ - Name: "show-removed", - Usage: "show removed sectors", + Name: "show-removed", + Usage: "show removed sectors", + Aliases: []string{"r"}, }, &cli.BoolFlag{ Name: "color", @@ -276,12 +277,14 @@ var sectorsListCmd = &cli.Command{ Aliases: []string{"c"}, }, &cli.BoolFlag{ - Name: "fast", - Usage: "don't show on-chain info for better performance", + Name: "fast", + Usage: "don't show on-chain info for better performance", + Aliases: []string{"f"}, }, &cli.BoolFlag{ - Name: "events", - Usage: "display number of events the sector has received", + Name: "events", + Usage: "display number of events the sector has received", + Aliases: []string{"e"}, }, &cli.BoolFlag{ Name: "seal-time", @@ -291,6 +294,11 @@ var sectorsListCmd = &cli.Command{ Name: "states", Usage: "filter sectors by a comma-separated list of states", }, + &cli.BoolFlag{ + Name: "unproven", + Usage: "only show sectors which aren't in the 'Proving' state", + Aliases: []string{"u"}, + }, }, Action: func(cctx *cli.Context) error { if cctx.IsSet("color") { @@ -314,17 +322,33 @@ var sectorsListCmd = &cli.Command{ var list []abi.SectorNumber showRemoved := cctx.Bool("show-removed") - states := cctx.String("states") - if len(states) == 0 { - list, err = nodeApi.SectorsList(ctx) - } else { + var states []api.SectorState + if cctx.IsSet("states") && cctx.IsSet("unproven") { + return xerrors.Errorf("only one of --states or --unproven can be specified at once") + } + + if cctx.IsSet("states") { showRemoved = true - sList := strings.Split(states, ",") - ss := make([]api.SectorState, len(sList)) + sList := strings.Split(cctx.String("states"), ",") + states = make([]api.SectorState, len(sList)) for i := range sList { - ss[i] = api.SectorState(sList[i]) + states[i] = api.SectorState(sList[i]) + } + } + + if cctx.Bool("unproven") { + for state := range sealing.ExistSectorStateList { + if state == sealing.Proving { + continue + } + states = append(states, api.SectorState(state)) } - list, err = nodeApi.SectorsListInStates(ctx, ss) + } + + if len(states) == 0 { + list, err = nodeApi.SectorsList(ctx) + } else { + list, err = nodeApi.SectorsListInStates(ctx, states) } if err != nil { diff --git a/documentation/en/cli-lotus-miner.md b/documentation/en/cli-lotus-miner.md index 8f6f16d9f64..32740e9de73 100644 --- a/documentation/en/cli-lotus-miner.md +++ b/documentation/en/cli-lotus-miner.md @@ -1532,13 +1532,14 @@ USAGE: lotus-miner sectors list [command options] [arguments...] OPTIONS: - --show-removed show removed sectors (default: false) - --color, -c use color in display output (default: depends on output being a TTY) - --fast don't show on-chain info for better performance (default: false) - --events display number of events the sector has received (default: false) - --seal-time display how long it took for the sector to be sealed (default: false) - --states value filter sectors by a comma-separated list of states - --help, -h show help (default: false) + --show-removed, -r show removed sectors (default: false) + --color, -c use color in display output (default: depends on output being a TTY) + --fast, -f don't show on-chain info for better performance (default: false) + --events, -e display number of events the sector has received (default: false) + --seal-time display how long it took for the sector to be sealed (default: false) + --states value filter sectors by a comma-separated list of states + --unproven, -u only show sectors which aren't in the 'Proving' state (default: false) + --help, -h show help (default: false) ```