Bug fixes, config generator
This commit is contained in:
@ -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,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -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{
|
||||
|
Reference in New Issue
Block a user