From e5820e2539a1c11ea5902874180e33ff2c8676a5 Mon Sep 17 00:00:00 2001 From: Jay Gabriels Date: Sun, 11 Dec 2022 08:33:14 -0800 Subject: [PATCH] Add better error message to all user clones --- CHANGELOG.md | 2 +- cmd/clone.go | 1 - scm/gitlab.go | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dedc9f1..5e3637c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -## [1.9.1] - unreleased +## [1.9.1] - 12/11/22 ### Added - Ability to clone all users repos on hosted GitLab instances; thanks @mlaily ### Changed diff --git a/cmd/clone.go b/cmd/clone.go index f44b4ac..684fac7 100644 --- a/cmd/clone.go +++ b/cmd/clone.go @@ -985,7 +985,6 @@ func setOutputDirName(argz []string) { outputDirName = strings.TrimSuffix(strings.TrimPrefix(u.Host, "www."), ".com") } - // If all-group is used set the parent folder to the name of the baseurl if argz[0] == "all-users" && os.Getenv("GHORG_SCM_BASE_URL") != "" { u, err := url.Parse(os.Getenv("GHORG_SCM_BASE_URL")) if err != nil { diff --git a/scm/gitlab.go b/scm/gitlab.go index a20cb64..cf6d15e 100644 --- a/scm/gitlab.go +++ b/scm/gitlab.go @@ -36,6 +36,10 @@ func (c Gitlab) GetOrgRepos(targetOrg string) ([]Repo, error) { repoData := []Repo{} longFetch := false + if targetOrg == "all-users" { + colorlog.PrintErrorAndExit("When using the 'all-users' keyword the '--clone-type=user' flag should be set") + } + if targetOrg == "all-groups" { longFetch = true