cmd/ipfs2: Added comment to explain default encoding logic

This commit is contained in:
Matt Bell 2014-11-11 16:32:18 -08:00 committed by Juan Batiz-Benet
parent aea2fce987
commit b358bb3ffd

View File

@ -132,6 +132,8 @@ func createRequest(args []string) (cmds.Request, *cmds.Command, error) {
ctx.ConfigRoot = configPath
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.Command().Marshallers != nil && req.Command().Marshallers[cmds.Text] != nil {
req.SetOption("encoding", cmds.Text)