diff --git a/site/content/completions/_index.md b/site/content/completions/_index.md index 2595a178..0115910f 100644 --- a/site/content/completions/_index.md +++ b/site/content/completions/_index.md @@ -319,7 +319,7 @@ cmd.RegisterFlagCompletionFunc("flag-name", cobra.NoFileCompletions) ``` If you find that there are more situations where file completion should be turned off than -when it is applicable, you can change the default `ShellCompDirective` for a command +when it is applicable, you can recursively change the default `ShellCompDirective` for a command and its subcommands to `ShellCompDirectiveNoFileComp`: ```go @@ -333,6 +333,8 @@ flags where file completion is applicable. For example: cmd.RegisterFlagCompletionFunc("flag-name", cobra.FixedCompletions(nil, ShellCompDirectiveDefault)) ``` +To change the default directive for the entire program, set the DefaultShellCompDirective on the root command. + #### Debugging You can also easily debug your Go completion code for flags: