Documentation ¶
Index ¶
- func EnvVarNames(_ *cobra.Command, _ []string, _ string) (names []string, _ cobra.ShellCompDirective)
- func FileNames(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective)
- func NoComplete(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective)
- func Platforms(_ *cobra.Command, _ []string, _ string) (platforms []string, _ cobra.ShellCompDirective)
- type APIClientProvider
- type ValidArgsFn
- func ContainerNames(dockerCLI APIClientProvider, all bool, filters ...func(types.Container) bool) ValidArgsFn
- func FromList(options ...string) ValidArgsFn
- func ImageNames(dockerCLI APIClientProvider) ValidArgsFn
- func NetworkNames(dockerCLI APIClientProvider) ValidArgsFn
- func VolumeNames(dockerCLI APIClientProvider) ValidArgsFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvVarNames ¶
func EnvVarNames(_ *cobra.Command, _ []string, _ string) (names []string, _ cobra.ShellCompDirective)
EnvVarNames offers completion for environment-variable names. This completion can be used for "--env" and "--build-arg" flags, which allow obtaining the value of the given environment-variable if present in the local environment, so we only should complete the names of the environment variables, and not their value. This also prevents the completion script from printing values of environment variables containing sensitive values.
For example;
export MY_VAR=hello docker run --rm --env MY_VAR alpine printenv MY_VAR hello
func FileNames ¶
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 NoComplete ¶
NoComplete is used for commands where there's no relevant completion
func Platforms ¶
func Platforms(_ *cobra.Command, _ []string, _ string) (platforms []string, _ cobra.ShellCompDirective)
Platforms offers completion for platform-strings. It provides a non-exhaustive list of platforms to be used for completion. Platform-strings are based on runtime.GOOS and runtime.GOARCH, but with (optional) variants added. A list of recognised os/arch combinations from the Go runtime can be obtained through "go tool dist list".
Some noteworthy exclusions from this list:
- arm64 images ("windows/arm64", "windows/arm64/v8") do not yet exist for windows.
- we don't (yet) include `os-variant` for completion (as can be used for Windows images)
- we don't (yet) include platforms for which we don't build binaries, such as BSD platforms (freebsd, netbsd, openbsd), android, macOS (darwin).
- we currently exclude architectures that may have unofficial builds, but don't have wide adoption (and no support), such as loong64, mipsXXX, ppc64 (non-le) to prevent confusion.
Types ¶
type APIClientProvider ¶
APIClientProvider provides a method to get an client.APIClient, initializing it if needed.
It's a smaller interface than [command.Cli], and used in situations where an APIClient is needed, but we want to postpone initializing the client until it's used.
type ValidArgsFn ¶
type ValidArgsFn func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
ValidArgsFn a function to be used by cobra command as `ValidArgsFunction` to offer command line completion
func ContainerNames ¶
func ContainerNames(dockerCLI APIClientProvider, all bool, filters ...func(types.Container) bool) ValidArgsFn
ContainerNames offers completion for container names and IDs By default, only names are returned. Set DOCKER_COMPLETION_SHOW_CONTAINER_IDS=yes to also complete IDs.
func FromList ¶
func FromList(options ...string) ValidArgsFn
FromList offers completion for the given list of options.
func ImageNames ¶
func ImageNames(dockerCLI APIClientProvider) ValidArgsFn
ImageNames offers completion for images present within the local store
func NetworkNames ¶
func NetworkNames(dockerCLI APIClientProvider) ValidArgsFn
NetworkNames offers completion for networks
func VolumeNames ¶
func VolumeNames(dockerCLI APIClientProvider) ValidArgsFn
VolumeNames offers completion for volumes