doc(iostreams): comment behavior of textual progress indicator

This commit is contained in:
Kynan Ware 2025-04-16 11:13:58 -06:00
parent 290e78c904
commit 056d292f26

View file

@ -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()