Removed commandswithdefaults method
This commit is contained in:
parent
9186f6e81a
commit
6fa7cfa8a6
13
cli.go
13
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
|
||||
|
Loading…
Reference in New Issue
Block a user