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

Function DisplayURL

internal/text/text.go:96–106  ·  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

94// If the scheme is not specified, "https" is assumed.
95// If there is an error parsing urlStr then urlStr is returned without modification.
96func DisplayURL(urlStr string) string {
97 u, err := url.Parse(urlStr)
98 if err != nil {
99 return urlStr
100 }
101 scheme := u.Scheme
102 if scheme == "" {
103 scheme = "https"
104 }
105 return scheme + "://" + u.Hostname() + u.Path
106}
107
108// RemoveDiacritics returns the input value without "diacritics", or accent marks
109func 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