Version and help check should look for local flags too
Now that Global looks up the chain of contexts, the top level should access the flags without the prefix (i.e. Bool rather than GlobalBool).
This commit is contained in:
4
help.go
4
help.go
@@ -181,7 +181,7 @@ func printHelp(out io.Writer, templ string, data interface{}) {
|
||||
}
|
||||
|
||||
func checkVersion(c *Context) bool {
|
||||
if c.GlobalBool("version") {
|
||||
if c.GlobalBool("version") || c.GlobalBool("v") || c.Bool("version") || c.Bool("v") {
|
||||
ShowVersion(c)
|
||||
return true
|
||||
}
|
||||
@@ -190,7 +190,7 @@ func checkVersion(c *Context) bool {
|
||||
}
|
||||
|
||||
func checkHelp(c *Context) bool {
|
||||
if c.GlobalBool("h") || c.GlobalBool("help") {
|
||||
if c.GlobalBool("h") || c.GlobalBool("help") || c.Bool("h") || c.Bool("help") {
|
||||
ShowAppHelp(c)
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user