MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / pluginsSorter

Function pluginsSorter

cli/cmd/init.go:147–162  ·  view source on GitHub ↗
(prioritySlice []string)

Source from the content-addressed store, hash-verified

145}
146
147func pluginsSorter(prioritySlice []string) func(a, b cqapi.ListPlugin) int {
148 return func(a, b cqapi.ListPlugin) int {
149 indexOfA := lo.IndexOf(prioritySlice, a.Name)
150 indexOfB := lo.IndexOf(prioritySlice, b.Name)
151 if indexOfA == -1 && indexOfB != -1 {
152 return 1
153 }
154 if indexOfA != -1 && indexOfB == -1 {
155 return -1
156 }
157 if indexOfA == -1 && indexOfB == -1 {
158 return cmp.Compare(a.Name, b.Name)
159 }
160 return cmp.Compare(indexOfA, indexOfB)
161 }
162}
163
164func extractYamlFromMarkdownCodeBlock(markdown string) string {
165 re := regexp.MustCompile("```yaml.*?\n([\\s\\S]+?)\n```")

Callers 2

selectSourceFunction · 0.85
selectDestinationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected