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

Function NetworkNames

cli/command/completion/functions.go:131–143  ·  view source on GitHub ↗

NetworkNames offers completion for networks

(dockerCLI APIClientProvider)

Source from the content-addressed store, hash-verified

129
130// NetworkNames offers completion for networks
131func NetworkNames(dockerCLI APIClientProvider) cobra.CompletionFunc {
132 return Unique(func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
133 res, err := dockerCLI.Client().NetworkList(cmd.Context(), client.NetworkListOptions{})
134 if err != nil {
135 return nil, cobra.ShellCompDirectiveError
136 }
137 var names []string
138 for _, nw := range res.Items {
139 names = append(names, nw.Name)
140 }
141 return names, cobra.ShellCompDirectiveNoFileComp
142 })
143}
144
145// EnvVarNames offers completion for environment-variable names. This
146// completion can be used for "--env" and "--build-arg" flags, which

Callers 1

TestCompleteNetworkNamesFunction · 0.85

Calls 3

UniqueFunction · 0.85
ClientMethod · 0.65
NetworkListMethod · 0.45

Tested by 1

TestCompleteNetworkNamesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…