changed progress to spinner
This commit is contained in:
parent
ff8e2ee079
commit
0b56f3b713
12
main.go
12
main.go
@ -35,7 +35,9 @@ func main() {
|
|||||||
fmt.Println(scanner.Err())
|
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)
|
Error(err)
|
||||||
|
|
||||||
@ -106,10 +108,10 @@ func main() {
|
|||||||
remainderString := strconv.Itoa(remainder)
|
remainderString := strconv.Itoa(remainder)
|
||||||
|
|
||||||
gtins = append(gtins, upc+remainderString)
|
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 {
|
if _, err := os.Stat(directory + "/answer.txt"); err == nil {
|
||||||
e := os.Remove(directory + "/answer.txt")
|
e := os.Remove(directory + "/answer.txt")
|
||||||
@ -124,8 +126,10 @@ func main() {
|
|||||||
for _, gtin := range gtins {
|
for _, gtin := range gtins {
|
||||||
_, err := answerFile.WriteString(gtin + "\n")
|
_, err := answerFile.WriteString(gtin + "\n")
|
||||||
Error(err)
|
Error(err)
|
||||||
answerProgressbar.Increment()
|
// answerProgressbar.Increment()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pterm.DefaultSpinner.Stop()
|
||||||
|
|
||||||
pterm.DefaultBasicText.Println("The answer.txt file has been successfully generated with check digits.")
|
pterm.DefaultBasicText.Println("The answer.txt file has been successfully generated with check digits.")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user