MCPcopy
hub / github.com/mislav/hub / parseRemoteNames

Function parseRemoteNames

commands/fetch.go:76–98  ·  view source on GitHub ↗
(args *Args)

Source from the content-addressed store, hash-verified

74}
75
76func parseRemoteNames(args *Args) (names []string) {
77 words := args.Words()
78 if i := args.IndexOfParam("--multiple"); i != -1 {
79 if args.ParamsSize() > 1 {
80 names = words
81 }
82 } else if len(words) > 0 {
83 remoteName := words[0]
84 commaPattern := fmt.Sprintf("^%s(,%s)+$", OwnerRe, OwnerRe)
85 remoteNameRegexp := regexp.MustCompile(commaPattern)
86 if remoteNameRegexp.MatchString(remoteName) {
87 i := args.IndexOfParam(remoteName)
88 args.RemoveParam(i)
89 names = strings.Split(remoteName, ",")
90 args.InsertParam(i, names...)
91 args.InsertParam(i, "--multiple")
92 } else {
93 names = append(names, remoteName)
94 }
95 }
96
97 return
98}

Callers 2

TestParseRemoteNamesFunction · 0.85
transformFetchArgsFunction · 0.85

Calls 5

WordsMethod · 0.80
IndexOfParamMethod · 0.80
ParamsSizeMethod · 0.80
RemoveParamMethod · 0.80
InsertParamMethod · 0.80

Tested by 1

TestParseRemoteNamesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…