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

Function completeObjectNames

cli/command/system/completion.go:323–353  ·  view source on GitHub ↗

completeObjectNames completes names of objects based on the "--type" flag TODO(thaJeztah): completion functions in this package don't remove names that have already been completed this causes completion to continue even if a given name was already completed.

(dockerCLI completion.APIClientProvider)

Source from the content-addressed store, hash-verified

321// TODO(thaJeztah): completion functions in this package don't remove names that have already been completed
322// this causes completion to continue even if a given name was already completed.
323func completeObjectNames(dockerCLI completion.APIClientProvider) cobra.CompletionFunc {
324 return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
325 if f := cmd.Flags().Lookup("type"); f != nil && f.Changed {
326 switch f.Value.String() {
327 case typeConfig:
328 return configNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
329 case typeContainer:
330 return containerNames(dockerCLI, cmd, args, toComplete), cobra.ShellCompDirectiveNoFileComp
331 case typeImage:
332 return imageNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
333 case typeNetwork:
334 return networkNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
335 case typeNode:
336 return nodeNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
337 case typePlugin:
338 return pluginNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
339 case typeSecret:
340 return secretNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
341 case typeService:
342 return serviceNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
343 case typeTask:
344 return taskNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
345 case typeVolume:
346 return volumeNames(dockerCLI, cmd), cobra.ShellCompDirectiveNoFileComp
347 default:
348 return nil, cobra.ShellCompDirectiveNoFileComp
349 }
350 }
351 return nil, cobra.ShellCompDirectiveNoFileComp
352 }
353}

Callers 1

newInspectCommandFunction · 0.85

Calls 11

configNamesFunction · 0.85
imageNamesFunction · 0.85
networkNamesFunction · 0.85
nodeNamesFunction · 0.85
pluginNamesFunction · 0.85
secretNamesFunction · 0.85
serviceNamesFunction · 0.85
taskNamesFunction · 0.85
volumeNamesFunction · 0.85
containerNamesFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…