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

Function completeNames

cli/command/config/cmd.go:39–51  ·  view source on GitHub ↗

completeNames offers completion for swarm configs

(dockerCLI completion.APIClientProvider)

Source from the content-addressed store, hash-verified

37
38// completeNames offers completion for swarm configs
39func completeNames(dockerCLI completion.APIClientProvider) cobra.CompletionFunc {
40 return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
41 res, err := dockerCLI.Client().ConfigList(cmd.Context(), client.ConfigListOptions{})
42 if err != nil {
43 return nil, cobra.ShellCompDirectiveError
44 }
45 var names []string
46 for _, config := range res.Items {
47 names = append(names, config.ID)
48 }
49 return names, cobra.ShellCompDirectiveNoFileComp
50 }
51}

Callers 3

newConfigInspectCommandFunction · 0.70
newConfigRemoveCommandFunction · 0.70
newRmCommandFunction · 0.50

Calls 2

ClientMethod · 0.65
ConfigListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…