feat: improved output and errors
This commit is contained in:
parent
ee892627a9
commit
1b1efcd3c1
2 changed files with 6 additions and 25 deletions
|
|
@ -79,11 +79,7 @@ func checkoutRepositories(repositories []Repository, concurrency int) {
|
|||
mu.Lock()
|
||||
clonedCount++
|
||||
if !debug {
|
||||
// update the progress bar
|
||||
descriptionPrefixPre := "Cloning repository "
|
||||
descriptionPrefix := descriptionPrefixPre + repoName + " ..."
|
||||
bar.Describe(descriptionPrefix)
|
||||
progressBarAdd(1)
|
||||
bar.Add(1)
|
||||
}
|
||||
mu.Unlock()
|
||||
|
||||
|
|
@ -92,10 +88,7 @@ func checkoutRepositories(repositories []Repository, concurrency int) {
|
|||
logger.Print("Decided to pull repository: "+repoName, nil)
|
||||
pullRepository(repoName, repoDestination)
|
||||
if !debug {
|
||||
descriptionPrefixPre := "Pulling repository "
|
||||
descriptionPrefix := descriptionPrefixPre + repoName + " ..."
|
||||
bar.Describe(descriptionPrefix)
|
||||
progressBarAdd(1)
|
||||
bar.Add(1)
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
@ -106,7 +99,7 @@ func checkoutRepositories(repositories []Repository, concurrency int) {
|
|||
mu.Lock()
|
||||
errorCount++
|
||||
if !debug {
|
||||
progressBarAdd(1)
|
||||
bar.Add(1)
|
||||
}
|
||||
mu.Unlock()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,15 +13,16 @@ var bar *progressbar.ProgressBar
|
|||
func progressBar() {
|
||||
|
||||
// configure progressbar
|
||||
bar = progressbar.NewOptions(2,
|
||||
bar = progressbar.NewOptions(100,
|
||||
progressbar.OptionEnableColorCodes(true),
|
||||
progressbar.OptionSetDescription("Logging into Git..."),
|
||||
progressbar.OptionSetDescription("..."),
|
||||
progressbar.OptionSetElapsedTime(false),
|
||||
progressbar.OptionSetPredictTime(false),
|
||||
progressbar.OptionSetWidth(20),
|
||||
progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
|
||||
progressbar.OptionShowCount(),
|
||||
progressbar.OptionShowDescriptionAtLineEnd(),
|
||||
progressbar.OptionShowElapsedTimeOnFinish(),
|
||||
progressbar.OptionSetTheme(progressbar.Theme{
|
||||
Saucer: "[green]=[reset]",
|
||||
SaucerHead: "[green]>[reset]",
|
||||
|
|
@ -31,20 +32,7 @@ func progressBar() {
|
|||
}),
|
||||
)
|
||||
|
||||
// initialize progressbar
|
||||
logger.Print("Initialize progressbar", nil)
|
||||
err := bar.RenderBlank()
|
||||
progressBarAdd(1)
|
||||
if err != nil {
|
||||
logger.Fatal("Initialization of the progressbar failed", err)
|
||||
}
|
||||
}
|
||||
|
||||
func progressBarAdd(amount int) {
|
||||
logger.Print("BAR: Progressing the bar", nil)
|
||||
if err := bar.Add(amount); err != nil {
|
||||
logger.Print("BAR: Could not update the bar", err)
|
||||
}
|
||||
}
|
||||
|
||||
func printSummary() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue