fix(comp): load plugins completion for __complete

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
pull/7690/head
Marc Khouzam 6 years ago
parent 26a9e3f62f
commit 6c884e0f61

@ -73,8 +73,11 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) {
} }
// If we are dealing with the completion command, we try to load more details about the plugins // If we are dealing with the completion command, we try to load more details about the plugins
// if available, so as to allow for command and flag completion // if available, so as to allow for command and flag completion.
if subCmd, _, err := baseCmd.Find(os.Args[1:]); err == nil && subCmd.Name() == "completion" { // For cases where the __complete command is used for command and flag completion (e.g., Fish completion),
// we also want to load the extra plugin information
subCmd, _, err := baseCmd.Find(os.Args[1:])
if err == nil && (subCmd.Name() == "completion" || subCmd.Name() == completion.CompRequestCmd) {
loadPluginsForCompletion(baseCmd, found) loadPluginsForCompletion(baseCmd, found)
return return
} }

Loading…
Cancel
Save