Better testing support. Easy to reset to blank slate in tests.

This commit is contained in:
spf13
2013-09-04 11:25:32 -04:00
parent a618569eea
commit c568b575aa
2 changed files with 13 additions and 5 deletions

View File

@ -150,6 +150,11 @@ func (c *Command) execute(args []string) (err error) {
return err
}
// Used for testing
func (c *Command) ResetCommands() {
c.commands = nil
}
// Add one or many commands as children of this
func (c *Command) AddCommand(cmds ...*Command) {
for i, x := range cmds {