Add godoc comments to exported symbols in pkg/cmd/agent-task and pkg/cmd/search

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Kynan Ware 2026-03-04 16:14:05 -07:00
parent 1a51fc61ae
commit e2e697722b
15 changed files with 74 additions and 0 deletions

View file

@ -16,6 +16,8 @@ import (
"github.com/spf13/cobra"
)
// CodeOptions is documented here.
// CodeOptions holds the options for the search code command.
type CodeOptions struct {
Browser browser.Browser
Config func() (gh.Config, error)
@ -26,6 +28,9 @@ type CodeOptions struct {
WebMode bool
}
// NewCmdCode is documented here.
// NewCmdCode returns a cobra command for searching code on GitHub.
func NewCmdCode(f *cmdutil.Factory, runF func(*CodeOptions) error) *cobra.Command {
opts := &CodeOptions{
Browser: f.Browser,

View file

@ -15,6 +15,8 @@ import (
"github.com/spf13/cobra"
)
// CommitsOptions is documented here.
// CommitsOptions holds the options for the search commits command.
type CommitsOptions struct {
Browser browser.Browser
Exporter cmdutil.Exporter
@ -25,6 +27,9 @@ type CommitsOptions struct {
WebMode bool
}
// NewCmdCommits is documented here.
// NewCmdCommits returns a cobra command for searching commits on GitHub.
func NewCmdCommits(f *cmdutil.Factory, runF func(*CommitsOptions) error) *cobra.Command {
var order string
var sort string

View file

@ -10,6 +10,8 @@ import (
"github.com/spf13/cobra"
)
// NewCmdIssues is documented here.
// NewCmdIssues returns a cobra command for searching issues on GitHub.
func NewCmdIssues(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobra.Command {
var locked, includePrs bool
var noAssignee, noLabel, noMilestone, noProject bool

View file

@ -11,6 +11,8 @@ import (
"github.com/spf13/cobra"
)
// NewCmdPrs is documented here.
// NewCmdPrs returns a cobra command for searching pull requests on GitHub.
func NewCmdPrs(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobra.Command {
var locked, merged bool
var noAssignee, noLabel, noMilestone, noProject bool

View file

@ -16,6 +16,8 @@ import (
"github.com/spf13/cobra"
)
// ReposOptions is documented here.
// ReposOptions holds the options for the search repos command.
type ReposOptions struct {
Browser browser.Browser
Exporter cmdutil.Exporter
@ -26,6 +28,9 @@ type ReposOptions struct {
WebMode bool
}
// NewCmdRepos is documented here.
// NewCmdRepos returns a cobra command for searching repositories on GitHub.
func NewCmdRepos(f *cmdutil.Factory, runF func(*ReposOptions) error) *cobra.Command {
var order string
var sort string

View file

@ -12,6 +12,8 @@ import (
searchReposCmd "github.com/cli/cli/v2/pkg/cmd/search/repos"
)
// NewCmdSearch is documented here.
// NewCmdSearch returns a cobra command for searching GitHub resources.
func NewCmdSearch(f *cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "search <command>",

View file

@ -15,6 +15,8 @@ import (
"github.com/cli/cli/v2/pkg/search"
)
// EntityType is documented here.
// EntityType represents the kind of entity to search for (issues, pull requests, or both).
type EntityType int
const (
@ -22,22 +24,32 @@ const (
// https://docs.github.com/en/rest/reference/search
SearchMaxResults = 1000
// Both is documented here.
// Issues is documented here.
// Both searches for issues and pull requests.
Both EntityType = iota
// Issues searches only for issues.
Issues
// IssuesOptions is documented here.
// PullRequests searches only for pull requests.
PullRequests
)
// IssuesOptions holds the options for searching issues and pull requests.
type IssuesOptions struct {
Browser browser.Browser
Entity EntityType
Exporter cmdutil.Exporter
IO *iostreams.IOStreams
Now time.Time
// Searcher is documented here.
Query search.Query
Searcher search.Searcher
WebMode bool
}
// Searcher creates a new search.Searcher using the factory's configuration.
func Searcher(f *cmdutil.Factory) (search.Searcher, error) {
cfg, err := f.Config()
if err != nil {
@ -50,11 +62,14 @@ func Searcher(f *cmdutil.Factory) (search.Searcher, error) {
return nil, err
}
// SearchIssues is documented here.
detector := fd.NewDetector(client, host)
return search.NewSearcher(client, host, detector), nil
}
// SearchIssues executes a search for issues or pull requests and displays the results.
func SearchIssues(opts *IssuesOptions) error {
io := opts.IO
if opts.WebMode {