Merge pull request #1389 from filecoin-project/feat/chain-get-raw-type
cli: add cbor-hex type to chain get
This commit is contained in:
commit
fb91ea2470
@ -451,6 +451,8 @@ var chainGetCmd = &cli.Command{
|
||||
|
||||
var cbu cbg.CBORUnmarshaler
|
||||
switch t {
|
||||
case "raw":
|
||||
cbu = nil
|
||||
case "block":
|
||||
cbu = new(types.BlockHeader)
|
||||
case "message":
|
||||
@ -476,6 +478,11 @@ var chainGetCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if cbu == nil {
|
||||
fmt.Printf("%x", raw)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := cbu.UnmarshalCBOR(bytes.NewReader(raw)); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal as %q", t)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user