core/commands: Added a Format function for the 'beep' command
Matt Bell committed
Oct 28, 2014 at 19:31 UTC
edb632a644f7d3ac8a880c8d009e798ccc9a0c99
1 file changed
+6
core/commands/root.go
+6
@@ -48,6 +48,12 @@ Use "ipfs help <command>" for more information about a command.
48
v := TestOutput{"hello, world", 1337}
49
res.SetValue(v)
50
},
51
+ Format: func(res cmds.Response) (string, error) {
52
+ v := res.Value().(TestOutput)
53
+ s := fmt.Sprintf("Foo: %s\n", v.Foo)
54
+ s += fmt.Sprintf("Bar: %v\n", v.Bar)
55
+ return s, nil
56
+ },
57
},
58
"boop": &cmds.Command{
59
Run: func(req cmds.Request, res cmds.Response) {