From 9f3662fa0a4e09852f33dc14e6c64d18bc16e047 Mon Sep 17 00:00:00 2001 From: codekid Date: Mon, 16 Mar 2020 00:40:03 +0530 Subject: [PATCH 1/2] add method to set text when the frames are running --- spin.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spin.go b/spin.go index ebfb407..0bc6917 100644 --- a/spin.go +++ b/spin.go @@ -98,6 +98,12 @@ func (s *Spinner) Set(frames string) { s.frames = []rune(frames) } +// SetText can change the text passed by during New() method +// in between the animation +func (s *Spinner) SetText(text string) { + s.text = text +} + // Start shows the spinner. func (s *Spinner) Start() *Spinner { if atomic.LoadUint64(&s.active) > 0 { From b1f33d1bd3b711e4efdeb637e22555a97209e213 Mon Sep 17 00:00:00 2001 From: codekid Date: Mon, 16 Mar 2020 00:48:43 +0530 Subject: [PATCH 2/2] oops forgot clearline --- spin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spin.go b/spin.go index 0bc6917..667ebed 100644 --- a/spin.go +++ b/spin.go @@ -101,7 +101,7 @@ func (s *Spinner) Set(frames string) { // SetText can change the text passed by during New() method // in between the animation func (s *Spinner) SetText(text string) { - s.text = text + s.text = ClearLine + text } // Start shows the spinner.