MCPcopy Create free account
hub / github.com/cli/cli / parseArtifactURLs

Function parseArtifactURLs

pkg/cmd/issue/artifact/shared/shared.go:147–166  ·  view source on GitHub ↗

parseArtifactURLs reads every argument as an artifact URL on the same issue.

(args []string)

Source from the content-addressed store, hash-verified

145// parseArtifactURLs reads every argument as an artifact URL on the same
146// issue.
147func parseArtifactURLs(args []string) (int, func() (ghrepo.Interface, error), []int, error) {
148 var repo ghrepo.Interface
149 var issueNumber int
150 numbers := make([]int, 0, len(args))
151 for _, arg := range args {
152 r, issue, number, err := parseArtifactURL(arg)
153 if err != nil {
154 return 0, nil, nil, err
155 }
156 if repo == nil {
157 repo, issueNumber = r, issue
158 } else if issue != issueNumber || !ghrepo.IsSame(r, repo) {
159 return 0, nil, nil, errors.New("artifact URLs must all be on the same issue")
160 }
161 if numbers, err = appendNew(numbers, number); err != nil {
162 return 0, nil, nil, err
163 }
164 }
165 return issueNumber, func() (ghrepo.Interface, error) { return repo, nil }, numbers, nil
166}
167
168// parseArtifactURL reads an artifact URL into its repository, issue number
169// and artifact number. Like an issue URL, it may be http, and its query and

Callers 1

ParseArtifactArgsFunction · 0.85

Calls 3

IsSameFunction · 0.92
parseArtifactURLFunction · 0.85
appendNewFunction · 0.85

Tested by

no test coverage detected