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