MCPcopy
hub / github.com/mislav/hub / WebURL

Method WebURL

github/project.go:31–63  ·  view source on GitHub ↗
(name, owner, path string)

Source from the content-addressed store, hash-verified

29}
30
31func (p *Project) WebURL(name, owner, path string) string {
32 if owner == "" {
33 owner = p.Owner
34 }
35 if name == "" {
36 name = p.Name
37 }
38
39 ownerWithName := fmt.Sprintf("%s/%s", owner, name)
40 if strings.Contains(ownerWithName, ".wiki") {
41 ownerWithName = strings.TrimSuffix(ownerWithName, ".wiki")
42 if path != "wiki" {
43 if strings.HasPrefix(path, "commits") {
44 path = "_history"
45 } else if path != "" {
46 path = fmt.Sprintf("_%s", path)
47 }
48
49 if path != "" {
50 path = utils.ConcatPaths("wiki", path)
51 } else {
52 path = "wiki"
53 }
54 }
55 }
56
57 url := fmt.Sprintf("%s://%s", p.Protocol, utils.ConcatPaths(p.Host, ownerWithName))
58 if path != "" {
59 url = utils.ConcatPaths(url, path)
60 }
61
62 return url
63}
64
65func (p *Project) GitURL(name, owner string, isSSH bool) (url string) {
66 if name == "" {

Callers 6

createFunction · 0.95
TestProject_WebURLFunction · 0.95
compareFunction · 0.80
browseFunction · 0.80
showPrFunction · 0.80
CreatePullRequestMethod · 0.80

Calls 1

ConcatPathsFunction · 0.92

Tested by 1

TestProject_WebURLFunction · 0.76