mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-10 02:40:11 +08:00
core/commands: Added Type to 'beep' command
This commit is contained in:
parent
54587897c1
commit
7b2f4488b7
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user