paginate
This commit is contained in:
parent
ebbcdeeb30
commit
f0e5bafff9
24
main.go
24
main.go
@ -61,13 +61,23 @@ func main() {
|
||||
}
|
||||
fmt.Printf("Found \"%s\"\n", org.WebURL)
|
||||
|
||||
repoList, _, err := client.Groups.ListGroupProjects(org.ID, &gitlab.ListGroupProjectsOptions{
|
||||
ListOptions: gitlab.ListOptions{},
|
||||
Archived: optBool(false),
|
||||
IncludeSubgroups: optBool(false),
|
||||
})
|
||||
if err != nil {
|
||||
error(5, "Could not obtain repo list: %v\n", err)
|
||||
var repoList []*gitlab.Project
|
||||
var page = 1
|
||||
for {
|
||||
repos, _, err := client.Groups.ListGroupProjects(org.ID, &gitlab.ListGroupProjectsOptions{
|
||||
ListOptions: gitlab.ListOptions{PerPage: 10, Page: page},
|
||||
Archived: optBool(false),
|
||||
IncludeSubgroups: optBool(false),
|
||||
})
|
||||
if err != nil {
|
||||
error(5, "Could not obtain repo list: %v\n", err)
|
||||
}
|
||||
|
||||
repoList = append(repoList, repos...)
|
||||
|
||||
if len(repoList) < 10 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for i := range repoList {
|
||||
|
Loading…
Reference in New Issue
Block a user