Merge pull request #143 from artnez/master
Add Context.GlobalFlagNames()
This commit is contained in:
commit
0cd0f1a3ae
12
context.go
12
context.go
@ -140,6 +140,18 @@ func (c *Context) FlagNames() (names []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a slice of global flag names used by the app.
|
||||||
|
func (c *Context) GlobalFlagNames() (names []string) {
|
||||||
|
for _, flag := range c.App.Flags {
|
||||||
|
name := strings.Split(flag.getName(), ",")[0]
|
||||||
|
if name == "help" || name == "version" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
type Args []string
|
type Args []string
|
||||||
|
|
||||||
// Returns the command line arguments associated with the context.
|
// Returns the command line arguments associated with the context.
|
||||||
|
Loading…
Reference in New Issue
Block a user