Move from --gitlab flags to global --remote flags

This commit is contained in:
2024-01-17 10:06:20 -05:00
parent f33199bd7b
commit 702f599f5f
19 changed files with 152 additions and 121 deletions

View File

@@ -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
}