cli: disable file-completion by default
This uses the DefaultShellCompDirective feature which was added in cobra to override the default (which would complete to use files for commands and flags). Note that we set "cobra.NoFileCompletions" for many commands, which is redundant with this change, so we could remove as well. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -76,13 +76,6 @@ func newRunCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
_ = cmd.RegisterFlagCompletionFunc("detach-keys", completeDetachKeys)
|
||||
addCompletions(cmd, dockerCLI)
|
||||
|
||||
flags.VisitAll(func(flag *pflag.Flag) {
|
||||
// Set a default completion function if none was set. We don't look
|
||||
// up if it does already have one set, because Cobra does this for
|
||||
// us, and returns an error (which we ignore for this reason).
|
||||
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
|
||||
})
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user