commands: Export command Run function
Matt Bell committed
Oct 21, 2014 at 15:24 UTC
4896123c1465fa5766c9f2c842590095e7c2681a
1 file changed
+3
-3
commands/command.go
+3
-3
@@ -20,8 +20,8 @@ type Function func(Request, Response)
20
type Command struct {
21
Help string
22
Options []Option
23
+ Run Function
24
24
- run Function
25
subcommands map[string]*Command
26
}
27
@@ -59,7 +59,7 @@ func (c *Command) Call(req Request, out io.Writer) Response {
59
}
60
cmd := cmds[len(cmds)-1]
61
62
- if cmd.run == nil {
62
+ if cmd.Run == nil {
63
res.SetError(ErrNotCallable, ErrClient)
64
return res
65
}
@@ -76,7 +76,7 @@ func (c *Command) Call(req Request, out io.Writer) Response {
76
return res
77
}
78
79
- cmd.run(req, res)
79
+ cmd.Run(req, res)
80
81
return res
82
}