feat: improved bar prefix depending on repo count

This commit is contained in:
Simon Cornet 2025-01-02 00:13:41 +01:00
commit 0de1461fc3

View file

@ -178,6 +178,11 @@ func checkoutRepositories(repositories []Repository) {
// make progressbar using: // make progressbar using:
// - github.com/k0kubun/go-ansi // - github.com/k0kubun/go-ansi
// - github.com/schollz/progressbar/v3 // - github.com/schollz/progressbar/v3
barPrefix := fmt.Sprintf("Getting your one and only repository...")
if repoCount > 1 {
barPrefix = fmt.Sprintf("Getting your repositories...")
}
bar := progressbar.NewOptions( bar := progressbar.NewOptions(
repoCount, repoCount,
progressbar.OptionSetWriter(ansi.NewAnsiStdout()), progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
@ -186,7 +191,7 @@ func checkoutRepositories(repositories []Repository) {
progressbar.OptionSetElapsedTime(true), progressbar.OptionSetElapsedTime(true),
progressbar.OptionSetPredictTime(false), progressbar.OptionSetPredictTime(false),
progressbar.OptionSetWidth(20), progressbar.OptionSetWidth(20),
progressbar.OptionSetDescription("Getting your repositories..."), progressbar.OptionSetDescription(barPrefix),
progressbar.OptionSetTheme(progressbar.Theme{ progressbar.OptionSetTheme(progressbar.Theme{
Saucer: "[green]=[reset]", Saucer: "[green]=[reset]",
SaucerHead: "[green]>[reset]", SaucerHead: "[green]>[reset]",