Skip to content

Commit

Permalink
change ipfs dag get flag name from format to output-codec
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Sep 27, 2021
1 parent b83651b commit 56a2ae9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ format.
cmds.StringArg("ref", true, false, "The object to get").EnableStdin(),
},
Options: []cmds.Option{
cmds.StringOption("format", "f", "Format that the object will be serialized as.").WithDefault("dag-json"),
cmds.StringOption("output-codec", "Format that the object will be encoded as.").WithDefault("dag-json"),
},
Run: dagGet,
}
Expand Down
10 changes: 5 additions & 5 deletions core/commands/dag/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func dagGet(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) e
return err
}

format, _ := req.Options["format"].(string)
var fCodec mc.Code
if err := fCodec.Set(format); err != nil {
codecStr, _ := req.Options["output-codec"].(string)
var codec mc.Code
if err := codec.Set(codecStr); err != nil {
return err
}

Expand Down Expand Up @@ -54,9 +54,9 @@ func dagGet(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) e
}
}

encoder, err := multicodec.LookupEncoder(uint64(fCodec))
encoder, err := multicodec.LookupEncoder(uint64(codec))
if err != nil {
return fmt.Errorf("invalid encoding: %s - %s", format, err)
return fmt.Errorf("invalid encoding: %s - %s", codec, err)
}

r, w := io.Pipe()
Expand Down

0 comments on commit 56a2ae9

Please sign in to comment.