completeNames offers completion for swarm configs
(dockerCLI completion.APIClientProvider)
| 37 | |
| 38 | // completeNames offers completion for swarm configs |
| 39 | func 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 | } |
no test coverage detected
searching dependent graphs…