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

Function NewCmdIssues

pkg/cmd/search/issues/issues.go:13–209  ·  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. For more information about advanced issue search, see:
43 <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>
44
45 Use %[1]s--search-type%[1]s to select semantic or hybrid (keyword + semantic)
46 ranking instead of the default lexical search. Semantic and hybrid search are
47 scoped to issues, are relevance-ranked (so %[1]s--sort%[1]s and %[1]s--order%[1]s
48 cannot be used), return a single page of results, and are not available on
49 GitHub Enterprise Server.
50
51 For more information on handling search queries containing a hyphen, run %[1]sgh search --help%[1]s.
52 `, "`"),
53 Example: heredoc.Doc(`
54 # Search issues matching set of keywords "readme" and "typo"
55 $ gh search issues readme typo
56
57 # Search issues matching phrase "broken feature"
58 $ gh search issues "broken feature"
59
60 # Search issues using raw search qualifiers as separate arguments
61 $ gh search issues label:bug author:monalisa state:open
62
63 # Search issues and pull requests in cli organization
64 $ gh search issues --include-prs --owner=cli
65
66 # Search open issues assigned to yourself
67 $ gh search issues --assignee=@me --state=open
68
69 # Search issues with numerous comments
70 $ gh search issues --comments=">100"

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