From 056d292f2635395bdbdc79e9c95fee84bae61724 Mon Sep 17 00:00:00 2001 From: Kynan Ware <47394200+BagToad@users.noreply.github.com> Date: Wed, 16 Apr 2025 11:13:58 -0600 Subject: [PATCH] doc(iostreams): comment behavior of textual progress indicator --- pkg/iostreams/iostreams.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/iostreams/iostreams.go b/pkg/iostreams/iostreams.go index cfc0da170..ba2cc6b50 100644 --- a/pkg/iostreams/iostreams.go +++ b/pkg/iostreams/iostreams.go @@ -292,6 +292,10 @@ func (s *IOStreams) StartProgressIndicatorWithLabel(label string) { } if s.spinnerDisabled { + // If the spinner is disabled, simply print a + // textual progress indicator and return. + // This means that s.ProgressIndicator will be nil. + // See also: the comment on StopProgressIndicator() s.startTextualProgressIndicator(label) return } @@ -339,6 +343,9 @@ func (s *IOStreams) startTextualProgressIndicator(label string) { fmt.Fprintf(s.ErrOut, "%s%s", s.ColorScheme().Cyan(label), "\n") } +// StopProgressIndicator stops the progress indicator if it is running. +// Note that a textual progess indicator does not create a progress indicator, +// so this method is a no-op in that case. func (s *IOStreams) StopProgressIndicator() { s.progressIndicatorMu.Lock() defer s.progressIndicatorMu.Unlock()