Removed commandswithdefaults method

This commit is contained in:
Jeremy Saenz 2013-07-14 17:53:59 -07:00
parent 9186f6e81a
commit 6fa7cfa8a6

13
cli.go
View File

@ -18,11 +18,10 @@ var DefaultAction = ShowHelp
func Run(args []string) {
if len(args) > 1 {
command := args[1]
commands := CommandsWithDefaults()
for _, c := range commands {
if c.Name == command {
c.Action(command)
name := args[1]
for _, c := range append(Commands, HelpCommand) {
if c.Name == name {
c.Action(name)
return
}
}
@ -32,10 +31,6 @@ func Run(args []string) {
DefaultAction("")
}
func CommandsWithDefaults() []Command {
return append(append([]Command(nil), HelpCommand), Commands...)
}
type Command struct {
Name string
ShortName string