| 11 | ) |
| 12 | |
| 13 | func 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 | opts := &shared.IssuesOptions{ |
| 19 | Browser: f.Browser, |
| 20 | Entity: shared.Issues, |
| 21 | IO: f.IOStreams, |
| 22 | Query: search.Query{Kind: search.KindIssues, |
| 23 | Qualifiers: search.Qualifiers{Type: "issue"}}, |
| 24 | } |
| 25 | |
| 26 | cmd := &cobra.Command{ |
| 27 | Use: "issues [<query>]", |
| 28 | Short: "Search for issues", |
| 29 | // TODO advancedIssueSearchCleanup |
| 30 | // Update the links and remove the mention at GHES 3.17 version. |
| 31 | Long: heredoc.Docf(` |
| 32 | Search for issues on GitHub. |
| 33 | |
| 34 | The command supports constructing queries using the GitHub search syntax, |
| 35 | using the parameter and qualifier flags, or a combination of the two. |
| 36 | |
| 37 | GitHub search syntax is documented at: |
| 38 | <https://docs.github.com/search-github/searching-on-github/searching-issues-and-pull-requests> |
| 39 | |
| 40 | On supported GitHub hosts, advanced issue search syntax can be used in the |
| 41 | %[1]s--search%[1]s query. For more information about advanced issue search, see: |
| 42 | <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> |
| 43 | |
| 44 | For more information on handling search queries containing a hyphen, run %[1]sgh search --help%[1]s. |
| 45 | `, "`"), |
| 46 | Example: heredoc.Doc(` |
| 47 | # Search issues matching set of keywords "readme" and "typo" |
| 48 | $ gh search issues readme typo |
| 49 | |
| 50 | # Search issues matching phrase "broken feature" |
| 51 | $ gh search issues "broken feature" |
| 52 | |
| 53 | # Search issues and pull requests in cli organization |
| 54 | $ gh search issues --include-prs --owner=cli |
| 55 | |
| 56 | # Search open issues assigned to yourself |
| 57 | $ gh search issues --assignee=@me --state=open |
| 58 | |
| 59 | # Search issues with numerous comments |
| 60 | $ gh search issues --comments=">100" |
| 61 | |
| 62 | # Search issues without label "bug" |
| 63 | $ gh search issues -- -label:bug |
| 64 | |
| 65 | # Search issues only from un-archived repositories (default is all repositories) |
| 66 | $ gh search issues --owner github --archived=false |
| 67 | `), |
| 68 | RunE: func(c *cobra.Command, args []string) error { |
| 69 | if len(args) == 0 && c.Flags().NFlag() == 0 { |
| 70 | return cmdutil.FlagErrorf("specify search keywords or flags") |