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

Function DisplayURL

internal/text/text.go:71–81  ·  view source on GitHub ↗

DisplayURL returns a copy of the string urlStr removing everything except the scheme, hostname, and path. If the scheme is not specified, "https" is assumed. If there is an error parsing urlStr then urlStr is returned without modification.

(urlStr string)

Source from the content-addressed store, hash-verified

69// If the scheme is not specified, "https" is assumed.
70// If there is an error parsing urlStr then urlStr is returned without modification.
71func DisplayURL(urlStr string) string {
72 u, err := url.Parse(urlStr)
73 if err != nil {
74 return urlStr
75 }
76 scheme := u.Scheme
77 if scheme == "" {
78 scheme = "https"
79 }
80 return scheme + "://" + u.Hostname() + u.Path
81}
82
83// RemoveDiacritics returns the input value without "diacritics", or accent marks
84func RemoveDiacritics(value string) string {

Callers 15

viewRunFunction · 0.92
openInBrowserFunction · 0.92
viewRunFunction · 0.92
listRunFunction · 0.92
checkRunFunction · 0.92
viewRunFunction · 0.92
viewRunFunction · 0.92
listRunFunction · 0.92
commitsRunFunction · 0.92
SearchIssuesFunction · 0.92
reposRunFunction · 0.92
codeRunFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestDisplayURLFunction · 0.68