forked from filecoin-project/lotus
/
misc.go
40 lines (33 loc) · 755 Bytes
/
misc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"fmt"
"strconv"
"github.com/urfave/cli/v2"
"github.com/filecoin-project/go-fil-markets/storagemarket"
)
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
},
}