MCPcopy Index your code
hub / github.com/go-task/task / getScheme

Function getScheme

taskfile/node.go:87–105  ·  view source on GitHub ↗
(uri string)

Source from the content-addressed store, hash-verified

85}
86
87func getScheme(uri string) (string, error) {
88 u, err := giturls.Parse(uri)
89 if u == nil {
90 return "", err
91 }
92
93 isDotGit := strings.HasSuffix(strings.Split(u.Path, "//")[0], ".git")
94 isUnderscoreGit := strings.Contains(strings.Split(u.Path, "//")[0], "/_git/")
95 schemeIsGitCompatible := slices.Contains([]string{"git", "ssh", "https", "http"}, u.Scheme)
96 if (isDotGit || isUnderscoreGit) && schemeIsGitCompatible {
97 return "git", nil
98 }
99
100 if before, _, ok := strings.Cut(uri, "://"); ok {
101 return before, nil
102 }
103
104 return "", nil
105}

Callers 3

NewNodeFunction · 0.85
IsRemoteEntrypointFunction · 0.85
TestSchemeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestSchemeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…