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

Method URL

pkg/search/searcher.go:291–311  ·  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

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