Skip to content

Commit

Permalink
Add global flags to sub commands
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljs1990 committed Jan 28, 2019
1 parent 50b52ca commit b0494d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app.go
Expand Up @@ -147,6 +147,11 @@ func (a *App) Setup() {
}

fc := FlagCategories{}
// Merge global flags into sub commands
for _, flag := range a.Flags {
fc = fc.AddFlag(flag.GetCategory(), flag)
}

for _, flag := range c.Flags {
fc = fc.AddFlag(flag.GetCategory(), flag)
}
Expand Down

0 comments on commit b0494d5

Please sign in to comment.