stop all spinners on progress stop

This commit is contained in:
Michael Yang 2023-11-15 16:59:49 -08:00
parent 4d677ee389
commit 976068369b
2 changed files with 24 additions and 34 deletions

View file

@ -31,6 +31,12 @@ func NewProgress(w io.Writer) *Progress {
}
func (p *Progress) Stop() bool {
for _, state := range p.states {
if spinner, ok := state.(*Spinner); ok {
spinner.Stop()
}
}
if p.ticker != nil {
p.ticker.Stop()
p.ticker = nil