cli/command/completion: add FileNames utility
This is just a convenience function to allow defining completion to use the default (complete with filenames and directories). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -105,6 +105,13 @@ func NetworkNames(dockerCLI APIClientProvider) ValidArgsFn {
|
||||
}
|
||||
}
|
||||
|
||||
// FileNames is a convenience function to use [cobra.ShellCompDirectiveDefault],
|
||||
// which indicates to let the shell perform its default behavior after
|
||||
// completions have been provided.
|
||||
func FileNames(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return nil, cobra.ShellCompDirectiveDefault
|
||||
}
|
||||
|
||||
// NoComplete is used for commands where there's no relevant completion
|
||||
func NoComplete(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||
|
||||
Reference in New Issue
Block a user