When doing sectors update-state
, show a list of existing states if user inputs an invalid one.
This commit is contained in:
parent
c46e1574dd
commit
91a43c477c
@ -406,6 +406,7 @@ var sectorsCapacityCollateralCmd = &cli.Command{
|
|||||||
var sectorsUpdateCmd = &cli.Command{
|
var sectorsUpdateCmd = &cli.Command{
|
||||||
Name: "update-state",
|
Name: "update-state",
|
||||||
Usage: "ADVANCED: manually update the state of a sector, this may aid in error recovery",
|
Usage: "ADVANCED: manually update the state of a sector, this may aid in error recovery",
|
||||||
|
ArgsUsage: "<sectorNum> <newState>",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "really-do-it",
|
Name: "really-do-it",
|
||||||
@ -431,8 +432,13 @@ var sectorsUpdateCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("could not parse sector number: %w", err)
|
return xerrors.Errorf("could not parse sector number: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := sealing.ExistSectorStateList[sealing.SectorState(cctx.Args().Get(1))]; !ok {
|
newState := cctx.Args().Get(1)
|
||||||
return xerrors.Errorf("Not existing sector state")
|
if _, ok := sealing.ExistSectorStateList[sealing.SectorState(newState)]; !ok {
|
||||||
|
fmt.Printf(" \"%s\" is not a valid state. Possible states for sectors are: \n", newState)
|
||||||
|
for state := range sealing.ExistSectorStateList {
|
||||||
|
fmt.Printf("%s\n", string(state))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1)))
|
return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1)))
|
||||||
|
Loading…
Reference in New Issue
Block a user