提交 7b2f4488 作者: Matt Bell 提交者: Juan Batiz-Benet

core/commands: Added Type to 'beep' command

上级 54587897
......@@ -45,15 +45,16 @@ Use "ipfs help <command>" for more information about a command.
Subcommands: map[string]*cmds.Command{
"beep": &cmds.Command{
Run: func(req cmds.Request, res cmds.Response) {
v := TestOutput{"hello, world", 1337}
v := &TestOutput{"hello, world", 1337}
res.SetValue(v)
},
Format: func(res cmds.Response) (string, error) {
v := res.Value().(TestOutput)
v := res.Value().(*TestOutput)
s := fmt.Sprintf("Foo: %s\n", v.Foo)
s += fmt.Sprintf("Bar: %v\n", v.Bar)
return s, nil
},
Type: &TestOutput{},
},
"boop": &cmds.Command{
Run: func(req cmds.Request, res cmds.Response) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论