From 6ba7807f7b600b0117bf625ea07f96166c64bacc Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 25 Feb 2022 15:57:12 -0800 Subject: [PATCH] Add `ClearLine()` to UI implementations --- internal/runner/ui.go | 4 ++++ internal/runner/ui_multi.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/internal/runner/ui.go b/internal/runner/ui.go index dc339d5a1..f03ce4eb9 100644 --- a/internal/runner/ui.go +++ b/internal/runner/ui.go @@ -42,6 +42,10 @@ func (u *runnerUI) Interactive() bool { return false } +func (u *runnerUI) ClearLine() { + // NO-OP - noninteractive +} + // Output outputs a message directly to the terminal. The remaining // arguments should be interpolations for the format string. After the // interpolations you may add Options. diff --git a/internal/runner/ui_multi.go b/internal/runner/ui_multi.go index d3dc7015e..aacef5732 100644 --- a/internal/runner/ui_multi.go +++ b/internal/runner/ui_multi.go @@ -37,6 +37,12 @@ func (u *multiUI) Input(input *terminal.Input) (string, error) { return term.Input(input) } +func (u *multiUI) ClearLine() { + for _, u := range u.UIs { + u.ClearLine() + } +} + func (u *multiUI) Interactive() bool { for _, u := range u.UIs { if u.Interactive() {