MCPcopy Index your code
hub / github.com/git-bug/git-bug / IsURL

Function IsURL

commands/input/prompt.go:35–47  ·  view source on GitHub ↗

IsURL is a validator checking that the value is a fully formed URL

(name string, value string)

Source from the content-addressed store, hash-verified

33
34// IsURL is a validator checking that the value is a fully formed URL
35func IsURL(name string, value string) (string, error) {
36 u, err := url.Parse(value)
37 if err != nil {
38 return fmt.Sprintf("%s is invalid: %v", name, err), nil
39 }
40 if u.Scheme == "" {
41 return fmt.Sprintf("%s is missing a scheme", name), nil
42 }
43 if u.Host == "" {
44 return fmt.Sprintf("%s is missing a host", name), nil
45 }
46 return "", nil
47}
48
49// Prompts
50

Callers

nothing calls this directly

Calls 1

ParseMethod · 0.65

Tested by

no test coverage detected