Commit 4896123c authored by Matt Bell's avatar Matt Bell

commands: Export command Run function

parent 71ff571e
...@@ -20,8 +20,8 @@ type Function func(Request, Response) ...@@ -20,8 +20,8 @@ type Function func(Request, Response)
type Command struct { type Command struct {
Help string Help string
Options []Option Options []Option
Run Function
run Function
subcommands map[string]*Command subcommands map[string]*Command
} }
...@@ -59,7 +59,7 @@ func (c *Command) Call(req Request, out io.Writer) Response { ...@@ -59,7 +59,7 @@ func (c *Command) Call(req Request, out io.Writer) Response {
} }
cmd := cmds[len(cmds)-1] cmd := cmds[len(cmds)-1]
if cmd.run == nil { if cmd.Run == nil {
res.SetError(ErrNotCallable, ErrClient) res.SetError(ErrNotCallable, ErrClient)
return res return res
} }
...@@ -76,7 +76,7 @@ func (c *Command) Call(req Request, out io.Writer) Response { ...@@ -76,7 +76,7 @@ func (c *Command) Call(req Request, out io.Writer) Response {
return res return res
} }
cmd.run(req, res) cmd.Run(req, res)
return res return res
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment