This commit is contained in:
2023-12-08 16:52:26 -05:00
parent 424e572fe0
commit f17ce69ef8
23 changed files with 648 additions and 104 deletions

View File

@ -2,12 +2,13 @@ package gitlab
import (
"context"
"fmt"
"time"
"github.com/xanzy/go-gitlab"
)
const defProjectsPerPage = 100
const defProjectsPerPage = 30
type Client struct {
Ctx context.Context
@ -15,12 +16,11 @@ type Client struct {
}
type Project struct {
ID int
Description string
SSHURLToRepo string
HTTPURLToRepo string
WebURL string
// Owner User
ID int
Description string
SSHURLToRepo string
HTTPURLToRepo string
WebURL string
Name string
NameWithNamespace string
Path string
@ -51,6 +51,10 @@ type Progress struct {
TotalProjects int
}
func (p *Project) String() string {
return fmt.Sprintf("%s (%s)", p.Path, p.PathWithNamespace)
}
// Given there may be thousands of projects, this will return
// channels that stream progress info and then finally the full
// list of projects on separate channels
@ -77,6 +81,7 @@ func (c *Client) streamProjects(pi *ProgressInfo) {
Page: 1,
},
Archived: new(bool),
Owned: gitlab.Ptr[bool](true),
}
var numProjects int