Merge pull request #4038 from filecoin-project/feat/state-compute-json
add json output to state compute
This commit is contained in:
commit
e15065b142
13
cli/state.go
13
cli/state.go
@ -821,6 +821,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)
|
||||
@ -865,6 +869,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") {
|
||||
st, err := state.LoadStateTree(cbor.NewCborStore(apibstore.NewAPIBlockstore(api)), stout.Root)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user