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 (
"fmt"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"os"
"sort"
"strconv"
@ -136,6 +137,12 @@ var sectorsStatusCmd = &cli.Command{
var sectorsListCmd = &cli.Command{
Name: "list",
Usage: "List sectors",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "hide-removed",
Usage: "to hide Removed sectors",
},
},
Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
@ -192,19 +199,21 @@ var sectorsListCmd = &cli.Command{
continue
}
_, inSSet := commitedIDs[s]
_, inASet := activeIDs[s]
if !cctx.Bool("hide-removed") || st.State != api.SectorState(sealing.Removed) {
_, inSSet := commitedIDs[s]
_, inASet := activeIDs[s]
fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\t toUpgrade:%t\n",
s,
st.State,
yesno(inSSet),
yesno(inASet),
st.Ticket.Epoch,
st.Seed.Epoch,
st.Deals,
st.ToUpgrade,
)
fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\t toUpgrade:%t\n",
s,
st.State,
yesno(inSSet),
yesno(inASet),
st.Ticket.Epoch,
st.Seed.Epoch,
st.Deals,
st.ToUpgrade,
)
}
}
return w.Flush()