Merge pull request #286 from mktmpio/dedup-help-and-version

only display app version and help message once
This commit is contained in:
Jesse Szwedko 2015-10-18 17:28:50 -07:00
commit cffab77ecb
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
}

View File

@ -190,7 +190,6 @@ func checkVersion(c *Context) bool {
if VersionFlag.Name != "" {
eachName(VersionFlag.Name, func(name string) {
if c.GlobalBool(name) || c.Bool(name) {
ShowVersion(c)
found = true
}
})
@ -203,7 +202,6 @@ func checkHelp(c *Context) bool {
if HelpFlag.Name != "" {
eachName(HelpFlag.Name, func(name string) {
if c.GlobalBool(name) || c.Bool(name) {
ShowAppHelp(c)
found = true
}
})