MCPcopy Index your code
hub / github.com/cli/cli / reposRun

Function reposRun

pkg/cmd/search/repos/repos.go:131–159  ·  view source on GitHub ↗
(opts *ReposOptions)

Source from the content-addressed store, hash-verified

129}
130
131func reposRun(opts *ReposOptions) error {
132 io := opts.IO
133 if opts.WebMode {
134 url := opts.Searcher.URL(opts.Query)
135 if io.IsStdoutTTY() {
136 fmt.Fprintf(io.ErrOut, "Opening %s in your browser.\n", text.DisplayURL(url))
137 }
138 return opts.Browser.Browse(url)
139 }
140 io.StartProgressIndicator()
141 result, err := opts.Searcher.Repositories(opts.Query)
142 io.StopProgressIndicator()
143 if err != nil {
144 return err
145 }
146 if len(result.Items) == 0 && opts.Exporter == nil {
147 return cmdutil.NewNoResultsError("no repositories matched your search")
148 }
149 if err := io.StartPager(); err == nil {
150 defer io.StopPager()
151 } else {
152 fmt.Fprintf(io.ErrOut, "failed to start pager: %v\n", err)
153 }
154 if opts.Exporter != nil {
155 return opts.Exporter.Write(io, result.Items)
156 }
157
158 return displayResults(io, opts.Now, result)
159}
160
161func displayResults(io *iostreams.IOStreams, now time.Time, results search.RepositoriesResult) error {
162 if now.IsZero() {

Callers 2

NewCmdReposFunction · 0.85
TestReposRunFunction · 0.85

Calls 12

DisplayURLFunction · 0.92
NewNoResultsErrorFunction · 0.92
IsStdoutTTYMethod · 0.80
StartPagerMethod · 0.80
StopPagerMethod · 0.80
displayResultsFunction · 0.70
URLMethod · 0.65
BrowseMethod · 0.65
RepositoriesMethod · 0.65
StopProgressIndicatorMethod · 0.65
WriteMethod · 0.65

Tested by 1

TestReposRunFunction · 0.68