Move helper to iostreams

This commit is contained in:
JP Ungaretti 2023-02-09 22:23:58 +00:00
parent 5879923b4f
commit 43783a33a2
2 changed files with 8 additions and 4 deletions

View file

@ -57,10 +57,7 @@ func (a *App) StopProgressIndicator() {
}
func (a *App) RunWithProgress(label string, f func() error) error {
a.StartProgressIndicatorWithLabel(label)
defer a.StopProgressIndicator()
return f()
return a.io.RunWithProgress(label, f)
}
// Connects to a codespace using Live Share and returns that session

View file

@ -305,6 +305,13 @@ func (s *IOStreams) StopProgressIndicator() {
s.progressIndicator = nil
}
func (s *IOStreams) RunWithProgress(label string, f func() error) error {
s.StartProgressIndicatorWithLabel(label)
defer s.StopProgressIndicator()
return f()
}
func (s *IOStreams) StartAlternateScreenBuffer() {
if s.alternateScreenBufferEnabled {
s.alternateScreenBufferMu.Lock()