cmd/ipfs: Default to plaintext encoding if avilable, otherwise JSON
Matt Bell committed
Oct 28, 2014 at 20:18 UTC
54587897c13211e0baa2c03c04d24aec595da653
1 file changed
+8
cmd/ipfs/ipfs.go
+8
@@ -87,6 +87,14 @@ func main() {
87
ctx.ConfigRoot = configPath
88
ctx.Config = conf
89
90
+ if _, found := options.Option("encoding"); !found {
91
+ if req.Command().Format != nil {
92
+ req.SetOption("encoding", cmds.Text)
93
+ } else {
94
+ req.SetOption("encoding", cmds.JSON)
95
+ }
96
+ }
97
+
98
var res cmds.Response
99
if root == Root {
100
res = root.Call(req)