MCPcopy
hub / github.com/cli/cli / SearchQueryBuild

Function SearchQueryBuild

pkg/cmd/pr/shared/params.go:235–267  ·  view source on GitHub ↗
(options FilterOptions, advancedIssueSearchSyntax bool)

Source from the content-addressed store, hash-verified

233}
234
235func SearchQueryBuild(options FilterOptions, advancedIssueSearchSyntax bool) string {
236 var is, state string
237 switch options.State {
238 case "open", "closed":
239 state = options.State
240 case "merged":
241 is = "merged"
242 }
243
244 query := search.Query{
245 Qualifiers: search.Qualifiers{
246 Assignee: options.Assignee,
247 Author: options.Author,
248 Base: options.BaseBranch,
249 Draft: options.Draft,
250 Head: options.HeadBranch,
251 IssueType: options.IssueType,
252 Label: options.Labels,
253 Mentions: options.Mention,
254 Milestone: options.Milestone,
255 Repo: []string{options.Repo},
256 State: state,
257 Is: []string{is},
258 Type: options.Entity,
259 },
260 ImmutableKeywords: options.Search,
261 }
262
263 if !advancedIssueSearchSyntax {
264 return query.StandardSearchString()
265 }
266 return query.AdvancedIssueSearchString()
267}
268
269func QueryHasStateClause(searchQuery string) bool {
270 argv, err := shlex.Split(searchQuery)

Callers 1

ListURLWithQueryFunction · 0.85

Calls 2

StandardSearchStringMethod · 0.95

Tested by

no test coverage detected