cli-plugins: 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). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -164,6 +164,11 @@ func newPluginCommand(dockerCli *command.DockerCli, plugin *cobra.Command, meta
|
||||
DisableDescriptions: os.Getenv("DOCKER_CLI_DISABLE_COMPLETION_DESCRIPTION") != "",
|
||||
},
|
||||
}
|
||||
|
||||
// Disable file-completion by default. Most commands and flags should not
|
||||
// complete with filenames.
|
||||
cmd.CompletionOptions.SetDefaultShellCompDirective(cobra.ShellCompDirectiveNoFileComp)
|
||||
|
||||
opts, _ := cli.SetupPluginRootCommand(cmd)
|
||||
|
||||
cmd.SetIn(dockerCli.In())
|
||||
|
||||
Reference in New Issue
Block a user