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

Function NewCmdIssues

pkg/cmd/search/issues/issues.go:13–212  ·  view source on GitHub ↗
(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error)

Source from the content-addressed store, hash-verified

11)
12
13func NewCmdIssues(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobra.Command {
14 var locked, includePrs bool
15 var noAssignee, noLabel, noMilestone, noProject bool
16 var order, sort string
17 var appAuthor string
18 var searchType string
19 opts := &shared.IssuesOptions{
20 Browser: f.Browser,
21 Entity: shared.Issues,
22 IO: f.IOStreams,
23 Query: search.Query{Kind: search.KindIssues,
24 Qualifiers: search.Qualifiers{Type: "issue"}},
25 }
26
27 cmd := &cobra.Command{
28 Use: "issues [<query>]",
29 Short: "Search for issues",
30 // TODO advancedIssueSearchCleanup
31 // Update the links and remove the mention at GHES 3.17 version.
32 Long: heredoc.Docf(`
33 Search for issues on GitHub.
34
35 The command supports constructing queries using the GitHub search syntax,
36 using the parameter and qualifier flags, or a combination of the two.
37
38 GitHub search syntax is documented at:
39 <https://docs.github.com/search-github/searching-on-github/searching-issues-and-pull-requests>
40
41 On supported GitHub hosts, advanced issue search syntax can be used in the
42 %[1]s--search%[1]s query. Advanced search syntax, like boolean operators %[1]sOR%[1]s/%[1]sAND%[1]s,
43 and parentheses for nesting, must be passed as separate arguments, rather
44 than within a quoted multi-word string. This syntax is not supported with
45 %[1]s--web%[1]s. For more information about advanced issue search, see:
46 <https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/filtering-and-searching-issues-and-pull-requests#building-advanced-filters-for-issues>
47
48 Use %[1]s--search-type%[1]s to select semantic or hybrid (keyword + semantic)
49 ranking instead of the default lexical search. Semantic and hybrid search are
50 scoped to issues, are relevance-ranked (so %[1]s--sort%[1]s and %[1]s--order%[1]s
51 cannot be used), return a single page of results, and are not available on
52 GitHub Enterprise Server.
53
54 For more information on handling search queries containing a hyphen, run %[1]sgh search --help%[1]s.
55 `, "`"),
56 Example: heredoc.Doc(`
57 # Search issues matching set of keywords "readme" and "typo"
58 $ gh search issues readme typo
59
60 # Search issues matching phrase "broken feature"
61 $ gh search issues "broken feature"
62
63 # Search issues using raw search qualifiers as separate arguments
64 $ gh search issues label:bug author:monalisa state:open
65
66 # Search issues and pull requests in cli organization
67 $ gh search issues --include-prs --owner=cli
68
69 # Search open issues assigned to yourself
70 $ gh search issues --assignee=@me --state=open

Callers 1

TestNewCmdIssuesFunction · 0.85

Calls 8

FlagErrorfFunction · 0.92
SearcherFunction · 0.92
SearchIssuesFunction · 0.92
AddJSONFlagsFunction · 0.92
StringEnumFlagFunction · 0.92
NilBoolFlagFunction · 0.92
StringSliceEnumFlagFunction · 0.92
ChangedMethod · 0.80

Tested by 1

TestNewCmdIssuesFunction · 0.68