only display app version and help message once

When processing the flags for -h/--help and -v/--version, only check
the flags in checkVersion() and checkHelp() instead of also printing
the associated message.

This fixes the problem of `app -h` and `app -v` printing their output
twice. The doubling was caused by printing the message once for each
registred alias for the given flags (-h/--help and -v/--version).

Resolves #285
This commit is contained in:
Ryan Graham
2015-10-18 17:02:23 -07:00
parent aba9469083
commit 732e97aee8
2 changed files with 2 additions and 2 deletions

2
app.go
View File

@@ -138,10 +138,12 @@ func (a *App) Run(arguments []string) (err error) {
}
if !a.HideHelp && checkHelp(context) {
ShowAppHelp(context)
return nil
}
if !a.HideVersion && checkVersion(context) {
ShowVersion(context)
return nil
}