From 6fa7cfa8a6805d4056e6e425a02368af5fb42694 Mon Sep 17 00:00:00 2001 From: Jeremy Saenz Date: Sun, 14 Jul 2013 17:53:59 -0700 Subject: [PATCH] Removed commandswithdefaults method --- cli.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cli.go b/cli.go index f277780..b1d9015 100644 --- a/cli.go +++ b/cli.go @@ -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