mirror of https://github.com/spf13/cobra.git
call Root PersistentPreRun on Completion Command
This commit is contained in:
parent
2d1eeaf169
commit
ef1328f8cf
|
@ -689,6 +689,9 @@ See each sub-command's help for details on how to use the generated script.
|
|||
flag.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)
|
||||
},
|
||||
}
|
||||
c.AddCommand(completionCmd)
|
||||
|
|
Loading…
Reference in New Issue