From edb632a644f7d3ac8a880c8d009e798ccc9a0c99 Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Tue, 28 Oct 2014 19:31:50 -0700 Subject: [PATCH] core/commands: Added a Format function for the 'beep' command --- core/commands/root.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/commands/root.go b/core/commands/root.go index 4a53606f8..245a955b0 100644 --- a/core/commands/root.go +++ b/core/commands/root.go @@ -48,6 +48,12 @@ Use "ipfs help " for more information about a command. v := TestOutput{"hello, world", 1337} res.SetValue(v) }, + Format: func(res cmds.Response) (string, error) { + v := res.Value().(TestOutput) + s := fmt.Sprintf("Foo: %s\n", v.Foo) + s += fmt.Sprintf("Bar: %v\n", v.Bar) + return s, nil + }, }, "boop": &cmds.Command{ Run: func(req cmds.Request, res cmds.Response) {