add json output to state compute
This commit is contained in:
parent
eaf3424938
commit
8545c08f30
13
cli/state.go
13
cli/state.go
@ -818,6 +818,10 @@ var stateComputeStateCmd = &cli.Command{
|
||||
Name: "html",
|
||||
Usage: "generate html report",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "json",
|
||||
Usage: "generate json output",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
@ -862,6 +866,15 @@ var stateComputeStateCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if cctx.Bool("json") {
|
||||
out, err := json.Marshal(stout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(string(out))
|
||||
return nil
|
||||
}
|
||||
|
||||
if cctx.Bool("html") {
|
||||
codeCache := map[address.Address]cid.Cid{}
|
||||
getCode := func(addr address.Address) (cid.Cid, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user