completeIpc implements shell completion for the `--ipc` option of `run` and `create`. The completion is partly composite.
(dockerCLI completion.APIClientProvider)
| 157 | // completeIpc implements shell completion for the `--ipc` option of `run` and `create`. |
| 158 | // The completion is partly composite. |
| 159 | func 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`. |
| 179 | func completeLink(dockerCLI completion.APIClientProvider) cobra.CompletionFunc { |
no test coverage detected
searching dependent graphs…