From dd0a0b3045fde60f8fd2bec7c0b1435173b80fa1 Mon Sep 17 00:00:00 2001 From: Sukh Date: Fri, 25 Jul 2025 19:49:59 -0400 Subject: [PATCH] docs(search): add reference to `gh help search` --- pkg/cmd/search/code/code.go | 3 +-- pkg/cmd/search/commits/commits.go | 7 +++---- pkg/cmd/search/issues/issues.go | 7 +++---- pkg/cmd/search/prs/prs.go | 7 +++---- pkg/cmd/search/repos/repos.go | 7 +++---- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/pkg/cmd/search/code/code.go b/pkg/cmd/search/code/code.go index 3a439e5cd..5e80c1017 100644 --- a/pkg/cmd/search/code/code.go +++ b/pkg/cmd/search/code/code.go @@ -47,8 +47,7 @@ func NewCmdCode(f *cmdutil.Factory, runF func(*CodeOptions) error) *cobra.Comman The results might not match what is seen on %[1]sgithub.com%[1]s, and new features like regex search are not yet available via the GitHub API. - Note: When using GitHub search syntax to exclude results (e.g. '-language:xml'), you must use - a '--' delimiter before the search query to separate it from command flags. + For more information on handling search queries containing a hyphen, run %[1]sgh help search-syntax%[1]s. `, "`"), Example: heredoc.Doc(` # Search code matching "react" and "lifecycle" diff --git a/pkg/cmd/search/commits/commits.go b/pkg/cmd/search/commits/commits.go index 161ecc6a9..ed5d1f758 100644 --- a/pkg/cmd/search/commits/commits.go +++ b/pkg/cmd/search/commits/commits.go @@ -37,7 +37,7 @@ func NewCmdCommits(f *cmdutil.Factory, runF func(*CommitsOptions) error) *cobra. cmd := &cobra.Command{ Use: "commits []", Short: "Search for commits", - Long: heredoc.Doc(` + Long: heredoc.Docf(` Search for commits on GitHub. The command supports constructing queries using the GitHub search syntax, @@ -46,9 +46,8 @@ func NewCmdCommits(f *cmdutil.Factory, runF func(*CommitsOptions) error) *cobra. GitHub search syntax is documented at: - Note: When using GitHub search syntax to exclude results (e.g. '-user:monalisa'), you must use - a '--' delimiter before the search query to separate it from command flags. - `), + For more information on handling search queries containing a hyphen, run %[1]sgh help search-syntax%[1]s. + `, "`"), Example: heredoc.Doc(` # Search commits matching set of keywords "readme" and "typo" $ gh search commits readme typo diff --git a/pkg/cmd/search/issues/issues.go b/pkg/cmd/search/issues/issues.go index af6e9d64c..0edca4b31 100644 --- a/pkg/cmd/search/issues/issues.go +++ b/pkg/cmd/search/issues/issues.go @@ -26,7 +26,7 @@ func NewCmdIssues(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *c cmd := &cobra.Command{ Use: "issues []", Short: "Search for issues", - Long: heredoc.Doc(` + Long: heredoc.Docf(` Search for issues on GitHub. The command supports constructing queries using the GitHub search syntax, @@ -35,9 +35,8 @@ func NewCmdIssues(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *c GitHub search syntax is documented at: - Note: When using GitHub search syntax to exclude results (e.g. '-label:bug'), you must use - a '--' delimiter before the search query to separate it from command flags. - `), + For more information on handling search queries containing a hyphen, run %[1]sgh help search-syntax%[1]s. + `, "`"), Example: heredoc.Doc(` # Search issues matching set of keywords "readme" and "typo" $ gh search issues readme typo diff --git a/pkg/cmd/search/prs/prs.go b/pkg/cmd/search/prs/prs.go index b268ea3e5..39203f5fb 100644 --- a/pkg/cmd/search/prs/prs.go +++ b/pkg/cmd/search/prs/prs.go @@ -28,7 +28,7 @@ func NewCmdPrs(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobr cmd := &cobra.Command{ Use: "prs []", Short: "Search for pull requests", - Long: heredoc.Doc(` + Long: heredoc.Docf(` Search for pull requests on GitHub. The command supports constructing queries using the GitHub search syntax, @@ -37,9 +37,8 @@ func NewCmdPrs(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobr GitHub search syntax is documented at: - Note: When using GitHub search syntax to exclude results (e.g. '-label:bug'), you must use - a '--' delimiter before the search query to separate it from command flags. - `), + For more information on handling search queries containing a hyphen, run %[1]sgh help search-syntax%[1]s. + `, "`"), Example: heredoc.Doc(` # Search pull requests matching set of keywords "fix" and "bug" $ gh search prs fix bug diff --git a/pkg/cmd/search/repos/repos.go b/pkg/cmd/search/repos/repos.go index 733d7b7c4..a7116dd58 100644 --- a/pkg/cmd/search/repos/repos.go +++ b/pkg/cmd/search/repos/repos.go @@ -38,7 +38,7 @@ func NewCmdRepos(f *cmdutil.Factory, runF func(*ReposOptions) error) *cobra.Comm cmd := &cobra.Command{ Use: "repos []", Short: "Search for repositories", - Long: heredoc.Doc(` + Long: heredoc.Docf(` Search for repositories on GitHub. The command supports constructing queries using the GitHub search syntax, @@ -47,9 +47,8 @@ func NewCmdRepos(f *cmdutil.Factory, runF func(*ReposOptions) error) *cobra.Comm GitHub search syntax is documented at: - Note: When using GitHub search syntax to exclude results (e.g. '-topic:linux'), you must use - a '--' delimiter before the search query to separate it from command flags. - `), + For more information on handling search queries containing a hyphen, run %[1]sgh help search-syntax%[1]s. + `, "`"), Example: heredoc.Doc(` # Search repositories matching set of keywords "cli" and "shell" $ gh search repos cli shell