@cryptotaxi247 / kubo / commits / 56a2ae92d

change ipfs dag get flag name from format to output-codec

Adin Schmahmann committed Sep 15, 2021 at 15:23 UTC 56a2ae92dc72b514c0a458e433a78d5984d587a0
2 files changed +6 -6
core/commands/dag/dag.go
+1 -1
@@ -116,7 +116,7 @@ format.
116 cmds.StringArg("ref", true, false, "The object to get").EnableStdin(),
117 },
118 Options: []cmds.Option{
119 - cmds.StringOption("format", "f", "Format that the object will be serialized as.").WithDefault("dag-json"),
119 + cmds.StringOption("output-codec", "Format that the object will be encoded as.").WithDefault("dag-json"),
120 },
121 Run: dagGet,
122 }
core/commands/dag/get.go
+5 -5
@@ -22,9 +22,9 @@ func dagGet(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) e
22 return err
23 }
24
25 - format, _ := req.Options["format"].(string)
26 - var fCodec mc.Code
27 - if err := fCodec.Set(format); err != nil {
25 + codecStr, _ := req.Options["output-codec"].(string)
26 + var codec mc.Code
27 + if err := codec.Set(codecStr); err != nil {
28 return err
29 }
30
@@ -54,9 +54,9 @@ func dagGet(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) e
54 }
55 }
56
57 - encoder, err := multicodec.LookupEncoder(uint64(fCodec))
57 + encoder, err := multicodec.LookupEncoder(uint64(codec))
58 if err != nil {
59 - return fmt.Errorf("invalid encoding: %s - %s", format, err)
59 + return fmt.Errorf("invalid encoding: %s - %s", codec, err)
60 }
61
62 r, w := io.Pipe()