MCPcopy Create free account
hub / github.com/cli/cli / groupWithOR

Function groupWithOR

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

Source from the content-addressed store, hash-verified

225}
226
227func groupWithOR(qualifier string, vs []string) string {
228 if len(vs) == 0 {
229 return ""
230 }
231
232 all := make([]string, 0, len(vs))
233 for _, v := range vs {
234 all = append(all, fmt.Sprintf("%s:%s", qualifier, quote(v)))
235 }
236
237 if len(all) == 1 {
238 return all[0]
239 }
240
241 slices.Sort(all)
242 return fmt.Sprintf("(%s)", strings.Join(all, " OR "))
243}
244
245// Map turns the qualifiers into a slice-keyed map ready for query
246// 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