Add an option to hide sectors in Removed for sectors list.

This commit is contained in:
jennijuju 2020-09-16 17:43:55 -04:00
parent 0c1c19c6ef
commit 14a4acec8c

View File

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"os" "os"
"sort" "sort"
"strconv" "strconv"
@ -136,6 +137,12 @@ var sectorsStatusCmd = &cli.Command{
var sectorsListCmd = &cli.Command{ var sectorsListCmd = &cli.Command{
Name: "list", Name: "list",
Usage: "List sectors", Usage: "List sectors",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "hide-removed",
Usage: "to hide Removed sectors",
},
},
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil { if err != nil {
@ -192,6 +199,7 @@ var sectorsListCmd = &cli.Command{
continue continue
} }
if !cctx.Bool("hide-removed") || st.State != api.SectorState(sealing.Removed) {
_, inSSet := commitedIDs[s] _, inSSet := commitedIDs[s]
_, inASet := activeIDs[s] _, inASet := activeIDs[s]
@ -206,6 +214,7 @@ var sectorsListCmd = &cli.Command{
st.ToUpgrade, st.ToUpgrade,
) )
} }
}
return w.Flush() return w.Flush()
}, },