(prioritySlice []string)
| 145 | } |
| 146 | |
| 147 | func 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 | |
| 164 | func extractYamlFromMarkdownCodeBlock(markdown string) string { |
| 165 | re := regexp.MustCompile("```yaml.*?\n([\\s\\S]+?)\n```") |
no outgoing calls
no test coverage detected