(dockerCli command.Cli, backendOptions *BackendOptions)
| 60 | } |
| 61 | |
| 62 | func completeProjectNames(dockerCli command.Cli, backendOptions *BackendOptions) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
| 63 | return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
| 64 | backend, err := compose.NewComposeService(dockerCli, backendOptions.Options...) |
| 65 | if err != nil { |
| 66 | return nil, cobra.ShellCompDirectiveError |
| 67 | } |
| 68 | |
| 69 | list, err := backend.List(cmd.Context(), api.ListOptions{ |
| 70 | All: true, |
| 71 | }) |
| 72 | if err != nil { |
| 73 | return nil, cobra.ShellCompDirectiveError |
| 74 | } |
| 75 | var values []string |
| 76 | for _, stack := range list { |
| 77 | if strings.HasPrefix(stack.Name, toComplete) { |
| 78 | values = append(values, stack.Name) |
| 79 | } |
| 80 | } |
| 81 | return values, cobra.ShellCompDirectiveNoFileComp |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | func completeProfileNames(dockerCli command.Cli, p *ProjectOptions) validArgsFn { |
| 86 | return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
no test coverage detected