JMS #4: Command.HasName
This commit is contained in:
parent
4495e2e996
commit
c15c42a7a8
2
cli.go
2
cli.go
@ -29,7 +29,7 @@ func Run(arguments []string) {
|
||||
if len(args) > 0 {
|
||||
name := args[0]
|
||||
for _, c := range append(Commands, HelpCommand) {
|
||||
if c.Name == name || c.ShortName == name {
|
||||
if c.HasName(name) {
|
||||
c.Run(context)
|
||||
return
|
||||
}
|
||||
|
@ -14,3 +14,7 @@ func (command Command) Run(c *Context) {
|
||||
set.Parse(c.Args()[1:])
|
||||
command.Action(NewContext(set, c.globalSet))
|
||||
}
|
||||
|
||||
func (command Command) HasName(name string) bool {
|
||||
return command.Name == name || command.ShortName == name
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user