feat: more seperate files

This commit is contained in:
Simon Cornet 2025-02-25 10:58:18 +01:00
commit 604c754589
4 changed files with 116 additions and 91 deletions

View file

@ -0,0 +1,53 @@
package main
import (
"fmt"
"github.com/k0kubun/go-ansi"
"github.com/schollz/progressbar/v3"
)
var bar *progressbar.ProgressBar
func progressBar(repositories []Repository) {
repoCount := len(repositories)
// make progressbar
barPrefix := fmt.Sprintf("Getting your one and only repository...")
if repoCount > 1 {
barPrefix = fmt.Sprintf("Getting your repositories...")
}
bar = progressbar.NewOptions(
repoCount,
progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
progressbar.OptionEnableColorCodes(true),
progressbar.OptionShowCount(),
progressbar.OptionShowDescriptionAtLineEnd(),
progressbar.OptionSetElapsedTime(false),
progressbar.OptionSetPredictTime(false),
progressbar.OptionSetWidth(20),
progressbar.OptionSetDescription(barPrefix),
progressbar.OptionSetTheme(progressbar.Theme{
Saucer: "[green]=[reset]",
SaucerHead: "[green]>[reset]",
SaucerPadding: " ",
BarStart: "[",
BarEnd: "]",
}),
)
}
func printSummary() {
fmt.Println("")
fmt.Printf(
"Summary:\n"+
" Cloned repositories: %v\n"+
" Pulled repositories: %v\n"+
" Errors: %v\n",
clonedCount,
pulledCount,
errorCount,
)
}