lotus/cmd/lotus-shed/misc.go

41 lines
755 B
Go
Raw Normal View History

2020-07-22 17:14:45 +00:00
package main
import (
"fmt"
"strconv"
"github.com/urfave/cli/v2"
2022-06-14 15:00:51 +00:00
"github.com/filecoin-project/go-fil-markets/storagemarket"
2020-07-22 17:14:45 +00:00
)
var miscCmd = &cli.Command{
Name: "misc",
Usage: "Assorted unsorted commands for various purposes",
Flags: []cli.Flag{},
Subcommands: []*cli.Command{
dealStateMappingCmd,
},
}
var dealStateMappingCmd = &cli.Command{
Name: "deal-state",
Action: func(cctx *cli.Context) error {
if !cctx.Args().Present() {
return cli.ShowCommandHelp(cctx, cctx.Command.Name)
}
num, err := strconv.Atoi(cctx.Args().First())
if err != nil {
return err
}
ststr, ok := storagemarket.DealStates[uint64(num)]
if !ok {
return fmt.Errorf("no such deal state %d", num)
}
fmt.Println(ststr)
return nil
},
}