(allPlugins []cqapi.ListPlugin, acceptDefaults bool)
| 237 | } |
| 238 | |
| 239 | func selectDestination(allPlugins []cqapi.ListPlugin, acceptDefaults bool) (string, error) { |
| 240 | officialDestinations := lo.Filter(allPlugins, officialReleasedPluginsByKind(cqapi.PluginKindDestination)) |
| 241 | slices.SortStableFunc(officialDestinations, pluginsSorter(destinationsOrder)) |
| 242 | if acceptDefaults { |
| 243 | return officialDestinations[0].Name, nil |
| 244 | } |
| 245 | |
| 246 | prompt := promptui.Select{ |
| 247 | Label: "Select Destination Plugin", |
| 248 | Items: lo.Map(officialDestinations, pluginName), |
| 249 | Stdin: os.Stdin, |
| 250 | Size: 10, |
| 251 | StartInSearchMode: true, |
| 252 | Searcher: func(input string, index int) bool { |
| 253 | return strings.Contains(officialDestinations[index].Name, input) |
| 254 | }, |
| 255 | } |
| 256 | |
| 257 | _, destination, err := prompt.Run() |
| 258 | if err != nil { |
| 259 | return "", fmt.Errorf("destination prompt failed %w", err) |
| 260 | } |
| 261 | |
| 262 | return destination, nil |
| 263 | } |
| 264 | |
| 265 | func linkForPlugin(plugin cqapi.ListPlugin) string { |
| 266 | return link.Sprintf("https://www.cloudquery.io/hub/plugins/%s/%s/%s", plugin.Kind, plugin.TeamName, plugin.Name) |
no test coverage detected