feat: added prerequisites
This commit is contained in:
parent
ce273209c1
commit
41d4efd624
3 changed files with 23 additions and 4 deletions
|
|
@ -62,12 +62,14 @@ func checkoutRepositories(repositories []Repository) {
|
|||
// create clone gitlab url
|
||||
repoName := string(repo.PathWithNamespace)
|
||||
gitlabUrl := fmt.Sprintf("https://gitlab-token:%s@%s/%s.git",
|
||||
gitlabToken, gitlabHost, repoName)
|
||||
gitlabToken,
|
||||
gitlabHost,
|
||||
repoName)
|
||||
|
||||
// create repository destination
|
||||
repoDestination := repoDestinationPre + repoName
|
||||
|
||||
// create bar description
|
||||
// create and update bar description
|
||||
descriptionPrefixPre := "Cloning repository "
|
||||
descriptionPrefix := descriptionPrefixPre + repoName + " ..."
|
||||
bar.Describe(descriptionPrefix)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ var gitlabHost string
|
|||
var clonedCount int
|
||||
var errorCount int
|
||||
var pulledCount int
|
||||
var pullError int
|
||||
var pullErrorMsg []string
|
||||
|
||||
type Repository struct {
|
||||
|
|
@ -26,6 +25,9 @@ func main() {
|
|||
// manage all argument magic
|
||||
manageArguments()
|
||||
|
||||
// check for git
|
||||
verifyGitAvailable()
|
||||
|
||||
// fetch repository information from gitlab
|
||||
repositories, err := fetchRepositories()
|
||||
if err != nil {
|
||||
|
|
|
|||
15
cmd/gogitlabber/prerequisites.go
Normal file
15
cmd/gogitlabber/prerequisites.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func verifyGitAvailable() {
|
||||
_, err := exec.LookPath("git")
|
||||
if err != nil {
|
||||
log.Fatalf("Error: could not find git in path")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue