MCPcopy Create free account
hub / github.com/cli/cli / URL

Method URL

pkg/search/searcher.go:290–310  ·  view source on GitHub ↗

URL returns URL to the global search in web GUI (i.e. github.com/search).

(query Query)

Source from the content-addressed store, hash-verified

288
289// URL returns URL to the global search in web GUI (i.e. github.com/search).
290func (s searcher) URL(query Query) string {
291 path := fmt.Sprintf("https://%s/search", s.host)
292 qs := url.Values{}
293 qs.Set("type", query.Kind)
294
295 // TODO advancedSearchFuture
296 // Currently, the global search GUI does not support the advanced issue
297 // search syntax (even for the issues/PRs tab on the sidebar). When the GUI
298 // is updated, we can use feature detection, and, if available, use the
299 // advanced search syntax.
300 qs.Set("q", query.StandardSearchString())
301
302 if query.Order != "" {
303 qs.Set(orderKey, query.Order)
304 }
305 if query.Sort != "" {
306 qs.Set(sortKey, query.Sort)
307 }
308 url := fmt.Sprintf("%s?%s", path, qs.Encode())
309 return url
310}
311
312func (err httpError) Error() string {
313 if err.StatusCode != 422 || len(err.Errors) == 0 {

Callers

nothing calls this directly

Calls 2

StandardSearchStringMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected