MCPcopy Create free account
hub / github.com/exercism/cli / InferSiteURL

Function InferSiteURL

config/config.go:120–129  ·  view source on GitHub ↗

InferSiteURL guesses what the website URL is. The basis for the guess is which API we're submitting to.

(apiURL string)

Source from the content-addressed store, hash-verified

118// InferSiteURL guesses what the website URL is.
119// The basis for the guess is which API we're submitting to.
120func InferSiteURL(apiURL string) string {
121 if apiURL == "" {
122 apiURL = defaultBaseURL
123 }
124 if apiURL == "https://api.exercism.org/v1" {
125 return "https://exercism.org"
126 }
127 re := regexp.MustCompile("^(https?://[^/]*).*")
128 return re.ReplaceAllString(apiURL, "$1")
129}
130
131// TokenURL provides a link to where the user can find their API token.
132func TokenURL(apiURL string) string {

Callers 2

TestInferSiteURLFunction · 0.85
TokenURLFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestInferSiteURLFunction · 0.68