(f *cmdutil.Factory)
| 13 | ) |
| 14 | |
| 15 | func NewCmdSearch(f *cmdutil.Factory) *cobra.Command { |
| 16 | cmd := &cobra.Command{ |
| 17 | Use: "search <command>", |
| 18 | Short: "Search for repositories, issues, and pull requests", |
| 19 | Long: heredoc.Docf(` |
| 20 | Search across all of GitHub. |
| 21 | |
| 22 | Excluding search results that match a qualifier |
| 23 | |
| 24 | In a browser, the GitHub search syntax supports excluding results that match a search qualifier |
| 25 | by prefixing the qualifier with a hyphen. For example, to search for issues that |
| 26 | do not have the label "bug", you would use %[1]s-label:bug%[1]s as a search qualifier. |
| 27 | |
| 28 | %[1]sgh%[1]s supports this syntax in %[1]sgh search%[1]s as well, but it requires extra |
| 29 | command line arguments to avoid the hyphen being interpreted as a command line flag because it begins with a hyphen. |
| 30 | |
| 31 | On Unix-like systems, you can use the %[1]s--%[1]s argument to indicate that |
| 32 | the arguments that follow are not a flag, but rather a query string. For example: |
| 33 | |
| 34 | $ gh search issues -- "my-search-query -label:bug" |
| 35 | |
| 36 | On PowerShell, you must use both the %[1]s--%[2]s%[1]s argument and the %[1]s--%[1]s argument to |
| 37 | produce the same effect. For example: |
| 38 | |
| 39 | $ gh --%[2]s search issues -- "my search query -label:bug" |
| 40 | |
| 41 | See the following for more information: |
| 42 | - GitHub search syntax: <https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#exclude-results-that-match-a-qualifier> |
| 43 | - The PowerShell stop parse flag %[1]s--%[2]s%[1]s: <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.5#the-stop-parsing-token> |
| 44 | - The Unix-like %[1]s--%[1]s argument: <https://www.gnu.org/software/bash/manual/bash.html#Shell-Builtin-Commands-1> |
| 45 | `, "`", "%"), |
| 46 | } |
| 47 | |
| 48 | cmd.AddCommand(searchCodeCmd.NewCmdCode(f, nil)) |
| 49 | cmd.AddCommand(searchCommitsCmd.NewCmdCommits(f, nil)) |
| 50 | cmd.AddCommand(searchIssuesCmd.NewCmdIssues(f, nil)) |
| 51 | cmd.AddCommand(searchPrsCmd.NewCmdPrs(f, nil)) |
| 52 | cmd.AddCommand(searchReposCmd.NewCmdRepos(f, nil)) |
| 53 | |
| 54 | return cmd |
| 55 | } |
nothing calls this directly
no outgoing calls
no test coverage detected