(allPlugins []cqapi.ListPlugin, acceptDefaults bool)
| 211 | } |
| 212 | |
| 213 | func selectSource(allPlugins []cqapi.ListPlugin, acceptDefaults bool) (string, error) { |
| 214 | officialSources := lo.Filter(allPlugins, officialReleasedPluginsByKind(cqapi.PluginKindSource)) |
| 215 | slices.SortStableFunc(officialSources, pluginsSorter(sourcesOrder)) |
| 216 | if acceptDefaults { |
| 217 | return officialSources[0].Name, nil |
| 218 | } |
| 219 | |
| 220 | prompt := promptui.Select{ |
| 221 | Label: "Select Source Plugin", |
| 222 | Items: lo.Map(officialSources, pluginName), |
| 223 | Stdin: os.Stdin, |
| 224 | Size: 10, |
| 225 | StartInSearchMode: true, |
| 226 | Searcher: func(input string, index int) bool { |
| 227 | return strings.Contains(officialSources[index].Name, input) |
| 228 | }, |
| 229 | } |
| 230 | |
| 231 | _, source, err := prompt.Run() |
| 232 | if err != nil { |
| 233 | return "", fmt.Errorf("source prompt failed %w", err) |
| 234 | } |
| 235 | |
| 236 | return source, nil |
| 237 | } |
| 238 | |
| 239 | func selectDestination(allPlugins []cqapi.ListPlugin, acceptDefaults bool) (string, error) { |
| 240 | officialDestinations := lo.Filter(allPlugins, officialReleasedPluginsByKind(cqapi.PluginKindDestination)) |
no test coverage detected