mirror of
https://github.com/spf13/cobra
synced 2024-12-29 15:57:10 +00:00
call Root PersitentPreRun on HelpCommand
This commit is contained in:
parent
94a3cb1439
commit
2d1eeaf169
1 changed files with 3 additions and 0 deletions
|
@ -1217,6 +1217,9 @@ Simply type ` + c.Name() + ` help [path to command] for full details.`,
|
|||
pflag.Annotations[BashCompOneRequiredFlag] = []string{"false"}
|
||||
}
|
||||
})
|
||||
// Adding PersistentPreRun on sub-commands prevents root's PersistentPreRun from being called.
|
||||
// So it is intentionally called here.
|
||||
cmd.Root().PersistentPreRun(cmd.Root(), args)
|
||||
},
|
||||
Run: func(c *Command, args []string) {
|
||||
cmd, _, e := c.Root().Find(args)
|
||||
|
|
Loading…
Reference in a new issue