Move from --gitlab flags to global --remote flags
This commit is contained in:
13
internal/cache/cache_load.go
vendored
13
internal/cache/cache_load.go
vendored
@@ -8,17 +8,24 @@ import (
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/load"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/remote"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
func (c *Cache) LoadRemotes() {
|
||||
func (c *Cache) LoadRemotes(gitRemotes ...string) {
|
||||
wg := &sync.WaitGroup{}
|
||||
writer := pterm.DefaultMultiPrinter
|
||||
|
||||
for _, r := range *c.Remotes {
|
||||
for _, r := range *c.remotes {
|
||||
// Don't bother if it's dead or the user has provided
|
||||
// one or more remotes via --remote flag(s)
|
||||
if !remote.IsAlive(r) {
|
||||
c.log.Error("Skipping load of remote, not alive", c.log.Args(
|
||||
"remote", r.String()))
|
||||
continue
|
||||
} else if !slices.Contains(gitRemotes, r.GetInfo().Host) {
|
||||
c.log.Debug("Skipping remote not in --remote list", c.log.Args(
|
||||
"remote", r.String(),
|
||||
))
|
||||
"remotes", gitRemotes))
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user