core/commands: Added Type to 'beep' command
Matt Bell committed
Oct 28, 2014 at 22:20 UTC
7b2f4488b7430f0a1d28ecf6a76b46feaeff5864
1 file changed
+3
-2
core/commands/root.go
+3
-2
@@ -45,15 +45,16 @@ Use "ipfs help <command>" for more information about a command.
45
Subcommands: map[string]*cmds.Command{
46
"beep": &cmds.Command{
47
Run: func(req cmds.Request, res cmds.Response) {
48
- v := TestOutput{"hello, world", 1337}
48
+ v := &TestOutput{"hello, world", 1337}
49
res.SetValue(v)
50
},
51
Format: func(res cmds.Response) (string, error) {
52
- v := res.Value().(TestOutput)
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
+ Type: &TestOutput{},
58
},
59
"boop": &cmds.Command{
60
Run: func(req cmds.Request, res cmds.Response) {