提交 b358bb3f 作者: Matt Bell 提交者: Juan Batiz-Benet

cmd/ipfs2: Added comment to explain default encoding logic

上级 aea2fce9
...@@ -132,6 +132,8 @@ func createRequest(args []string) (cmds.Request, *cmds.Command, error) { ...@@ -132,6 +132,8 @@ func createRequest(args []string) (cmds.Request, *cmds.Command, error) {
ctx.ConfigRoot = configPath ctx.ConfigRoot = configPath
ctx.Config = conf ctx.Config = conf
// if no encoding was specified by user, default to plaintext encoding
// (if command doesn't support plaintext, use JSON instead)
if !req.Option("encoding").Found() { if !req.Option("encoding").Found() {
if req.Command().Marshallers != nil && req.Command().Marshallers[cmds.Text] != nil { if req.Command().Marshallers != nil && req.Command().Marshallers[cmds.Text] != nil {
req.SetOption("encoding", cmds.Text) req.SetOption("encoding", cmds.Text)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论