MCPcopy
hub / github.com/cli/cli / groupWithOR

Function groupWithOR

pkg/search/query.go:220–236  ·  view source on GitHub ↗
(qualifier string, vs []string)

Source from the content-addressed store, hash-verified

218}
219
220func groupWithOR(qualifier string, vs []string) string {
221 if len(vs) == 0 {
222 return ""
223 }
224
225 all := make([]string, 0, len(vs))
226 for _, v := range vs {
227 all = append(all, fmt.Sprintf("%s:%s", qualifier, quote(v)))
228 }
229
230 if len(all) == 1 {
231 return all[0]
232 }
233
234 slices.Sort(all)
235 return fmt.Sprintf("(%s)", strings.Join(all, " OR "))
236}
237
238// Map turns the qualifiers into a slice-keyed map ready for query
239// formatting. Multiple struct fields can share the same key when

Callers 2

formatSpecialQualifiersFunction · 0.85

Calls 2

quoteFunction · 0.85
JoinMethod · 0.80

Tested by

no test coverage detected