Bug fixes, config generator

This commit is contained in:
2023-12-10 10:10:46 -05:00
parent 5d2ca40d04
commit cdf92c8a54
12 changed files with 124 additions and 23 deletions

View File

@ -13,13 +13,28 @@ type Config struct {
}
}
type cacheConfig struct {
Ttl time.Duration `yaml:"ttl" json:"ttl"`
File string `yaml:"file" json:"file"`
Load struct {
OwnerOnly bool `yaml:"ownerOnly" json:"ownerOnly"`
} `yaml:"load" json:"load"`
Clear struct {
ClearAliases bool `yaml:"clearAliases" json:"clearAliases"`
} `yaml:"clear" json:"clear"`
type loadConfig struct {
OwnerOnly bool `yaml:"ownerOnly" json:"ownerOnly"`
}
type cacheConfig struct {
Ttl time.Duration `yaml:"ttl,omitempty" json:"ttl,omitempty"`
File string `yaml:"file,omitempty" json:"file,omitempty"`
Load loadConfig `yaml:"load" json:"load"`
Clear struct {
ClearAliases bool `yaml:"clearAliases,omitempty" json:"clearAliases,omitempty"`
} `yaml:"clear,omitempty" json:"clear,omitempty"`
}
var DefaultConfig = Config{
GitlabHost: "https://gitlab.com",
GitlabToken: "yourtokenhere",
LogLevel: "warn",
ProjectPath: "~/work/projects",
Cache: cacheConfig{
Ttl: 168 * time.Hour,
Load: loadConfig{
OwnerOnly: true,
},
},
}

View File

@ -129,16 +129,17 @@ func (c *Client) streamProjects(pi *ProgressInfo, ownerOnly bool) {
for {
projects, resp, err := c.ListProjects(listOpts)
if err != nil {
pi.ErrorChan <- err
break
}
// We're done when we have it all or our context is done
if c.Ctx.Err() != nil || resp.NextPage == 0 {
pi.DoneChan <- nil
break
}
if err != nil {
pi.ErrorChan <- err
}
numProjects += len(projects)
pi.ProjectsChan <- projects
pi.ProgressChan <- Progress{