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

Function completeIpc

cli/command/container/completion.go:159–176  ·  view source on GitHub ↗

completeIpc implements shell completion for the `--ipc` option of `run` and `create`. The completion is partly composite.

(dockerCLI completion.APIClientProvider)

Source from the content-addressed store, hash-verified

157// completeIpc implements shell completion for the `--ipc` option of `run` and `create`.
158// The completion is partly composite.
159func completeIpc(dockerCLI completion.APIClientProvider) cobra.CompletionFunc {
160 return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
161 if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic // not swapped, matches partly typed "container"
162 return []string{"container:"}, cobra.ShellCompDirectiveNoSpace
163 }
164 if strings.HasPrefix(toComplete, "container:") {
165 names, _ := completion.ContainerNames(dockerCLI, true)(cmd, args, toComplete)
166 return prefixWith("container:", names), cobra.ShellCompDirectiveNoFileComp
167 }
168 return []string{
169 string(container.IPCModeContainer + ":"),
170 string(container.IPCModeHost),
171 string(container.IPCModeNone),
172 string(container.IPCModePrivate),
173 string(container.IPCModeShareable),
174 }, cobra.ShellCompDirectiveNoFileComp
175 }
176}
177
178// completeLink implements shell completion for the `--link` option of `run` and `create`.
179func completeLink(dockerCLI completion.APIClientProvider) cobra.CompletionFunc {

Callers 1

addCompletionsFunction · 0.85

Calls 1

prefixWithFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…