MCPcopy
hub / github.com/cli/cli / URL

Method URL

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

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