MCPcopy Create free account
hub / github.com/docker/cli / completeNames

Function completeNames

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

completeNames offers completion for swarm secrets

(dockerCLI completion.APIClientProvider)

Source from the content-addressed store, hash-verified

37
38// completeNames offers completion for swarm secrets
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().SecretList(cmd.Context(), client.SecretListOptions{})
42 if err != nil {
43 return nil, cobra.ShellCompDirectiveError
44 }
45 var names []string
46 for _, secret := range res.Items {
47 names = append(names, secret.Spec.Name)
48 }
49 return names, cobra.ShellCompDirectiveNoFileComp
50 }
51}

Callers 2

newSecretInspectCommandFunction · 0.70
newSecretRemoveCommandFunction · 0.70

Calls 2

ClientMethod · 0.65
SecretListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…