MCPcopy Index your code
hub / github.com/docker/cli / completeLogDriver

Function completeLogDriver

cli/command/container/completion.go:217–226  ·  view source on GitHub ↗

completeLogDriver implements shell completion for the `--log-driver` option of `run` and `create`. The log drivers are collected from a call to the Info endpoint with a fallback to a hard-coded list of the build-in log drivers.

(dockerCLI completion.APIClientProvider)

Source from the content-addressed store, hash-verified

215// The log drivers are collected from a call to the Info endpoint with a fallback to a hard-coded list
216// of the build-in log drivers.
217func completeLogDriver(dockerCLI completion.APIClientProvider) cobra.CompletionFunc {
218 return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
219 res, err := dockerCLI.Client().Info(cmd.Context(), client.InfoOptions{})
220 if err != nil {
221 return builtInLogDrivers(), cobra.ShellCompDirectiveNoFileComp
222 }
223 drivers := res.Info.Plugins.Log
224 return drivers, cobra.ShellCompDirectiveNoFileComp
225 }
226}
227
228// completeLogOpt implements shell completion for the `--log-opt` option of `run` and `create`.
229// If the user supplied a log-driver, only options for that driver are returned.

Callers 1

addCompletionsFunction · 0.85

Calls 2

ClientMethod · 0.65
InfoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…