changed progress to spinner

This commit is contained in:
John O'Keefe 2023-12-08 13:28:15 -05:00
parent ff8e2ee079
commit 0b56f3b713

12
main.go
View File

@ -35,7 +35,9 @@ func main() {
fmt.Println(scanner.Err())
}
upcProgressbar, err := pterm.DefaultProgressbar.WithTotal(len(upcs)).WithTitle("Processing UPCs").Start()
// upcProgressbar, err := pterm.DefaultProgressbar.WithTotal(len(upcs)).WithTitle("Processing UPCs").Start()
pterm.DefaultSpinner.Start()
Error(err)
@ -106,10 +108,10 @@ func main() {
remainderString := strconv.Itoa(remainder)
gtins = append(gtins, upc+remainderString)
upcProgressbar.Increment()
// upcProgressbar.Increment()
}
answerProgressbar, err := pterm.DefaultProgressbar.WithTotal(len(gtins)).WithTitle("Processing UPCs").Start()
// answerProgressbar, err := pterm.DefaultProgressbar.WithTotal(len(gtins)).WithTitle("Processing UPCs").Start()
if _, err := os.Stat(directory + "/answer.txt"); err == nil {
e := os.Remove(directory + "/answer.txt")
@ -124,8 +126,10 @@ func main() {
for _, gtin := range gtins {
_, err := answerFile.WriteString(gtin + "\n")
Error(err)
answerProgressbar.Increment()
// answerProgressbar.Increment()
}
pterm.DefaultSpinner.Stop()
pterm.DefaultBasicText.Println("The answer.txt file has been successfully generated with check digits.")
}