Fixing the issue with a command with subcommands not showing help message.

- the command name is "" and HasName was returning true for an empty
  ShortName.
- the Show method wasn't aware that command name was just "" and
  returned the first subcommand.
This commit is contained in:
Nicolas Dufour
2015-02-23 08:01:17 -05:00
parent 50c77ecec0
commit 4be878bffc
2 changed files with 7 additions and 1 deletions

View File

@@ -119,7 +119,7 @@ func (c Command) Run(ctx *Context) error {
// Returns true if Command.Name or Command.ShortName matches given name
func (c Command) HasName(name string) bool {
return c.Name == name || c.ShortName == name
return c.Name == name || (c.ShortName != "" && c.ShortName == name)
}
func (c Command) startApp(ctx *Context) error {