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()
|
mu.Lock()
|
||||||
clonedCount++
|
clonedCount++
|
||||||
if !debug {
|
if !debug {
|
||||||
// update the progress bar
|
bar.Add(1)
|
||||||
descriptionPrefixPre := "Cloning repository "
|
|
||||||
descriptionPrefix := descriptionPrefixPre + repoName + " ..."
|
|
||||||
bar.Describe(descriptionPrefix)
|
|
||||||
progressBarAdd(1)
|
|
||||||
}
|
}
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
|
|
||||||
|
|
@ -92,10 +88,7 @@ func checkoutRepositories(repositories []Repository, concurrency int) {
|
||||||
logger.Print("Decided to pull repository: "+repoName, nil)
|
logger.Print("Decided to pull repository: "+repoName, nil)
|
||||||
pullRepository(repoName, repoDestination)
|
pullRepository(repoName, repoDestination)
|
||||||
if !debug {
|
if !debug {
|
||||||
descriptionPrefixPre := "Pulling repository "
|
bar.Add(1)
|
||||||
descriptionPrefix := descriptionPrefixPre + repoName + " ..."
|
|
||||||
bar.Describe(descriptionPrefix)
|
|
||||||
progressBarAdd(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -106,7 +99,7 @@ func checkoutRepositories(repositories []Repository, concurrency int) {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
errorCount++
|
errorCount++
|
||||||
if !debug {
|
if !debug {
|
||||||
progressBarAdd(1)
|
bar.Add(1)
|
||||||
}
|
}
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,16 @@ var bar *progressbar.ProgressBar
|
||||||
func progressBar() {
|
func progressBar() {
|
||||||
|
|
||||||
// configure progressbar
|
// configure progressbar
|
||||||
bar = progressbar.NewOptions(2,
|
bar = progressbar.NewOptions(100,
|
||||||
progressbar.OptionEnableColorCodes(true),
|
progressbar.OptionEnableColorCodes(true),
|
||||||
progressbar.OptionSetDescription("Logging into Git..."),
|
progressbar.OptionSetDescription("..."),
|
||||||
progressbar.OptionSetElapsedTime(false),
|
progressbar.OptionSetElapsedTime(false),
|
||||||
progressbar.OptionSetPredictTime(false),
|
progressbar.OptionSetPredictTime(false),
|
||||||
progressbar.OptionSetWidth(20),
|
progressbar.OptionSetWidth(20),
|
||||||
progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
|
progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
|
||||||
progressbar.OptionShowCount(),
|
progressbar.OptionShowCount(),
|
||||||
progressbar.OptionShowDescriptionAtLineEnd(),
|
progressbar.OptionShowDescriptionAtLineEnd(),
|
||||||
|
progressbar.OptionShowElapsedTimeOnFinish(),
|
||||||
progressbar.OptionSetTheme(progressbar.Theme{
|
progressbar.OptionSetTheme(progressbar.Theme{
|
||||||
Saucer: "[green]=[reset]",
|
Saucer: "[green]=[reset]",
|
||||||
SaucerHead: "[green]>[reset]",
|
SaucerHead: "[green]>[reset]",
|
||||||
|
|
@ -31,20 +32,7 @@ func progressBar() {
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
// initialize progressbar
|
|
||||||
logger.Print("Initialize progressbar", nil)
|
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() {
|
func printSummary() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue