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

Method URL

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

268
269// URL returns URL to the global search in web GUI (i.e. github.com/search).
270func (s searcher) URL(query Query) string {
271 path := fmt.Sprintf("https://%s/search", s.host)
272 qs := url.Values{}
273 qs.Set("type", query.Kind)
274
275 // TODO advancedSearchFuture
276 // Currently, the global search GUI does not support the advanced issue
277 // search syntax (even for the issues/PRs tab on the sidebar). When the GUI
278 // is updated, we can use feature detection, and, if available, use the
279 // advanced search syntax.
280 qs.Set("q", query.StandardSearchString())
281
282 if query.Order != "" {
283 qs.Set(orderKey, query.Order)
284 }
285 if query.Sort != "" {
286 qs.Set(sortKey, query.Sort)
287 }
288 url := fmt.Sprintf("%s?%s", path, qs.Encode())
289 return url
290}
291
292func (err httpError) Error() string {
293 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