Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions util/progress/progressui/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ const (
// AutoMode will choose TtyMode or PlainMode depending on if the output is
// a tty.
AutoMode DisplayMode = "auto"
// QuietMode discards all output.
QuietMode DisplayMode = "quiet"
// TtyMode enforces the output is a tty and will otherwise cause an error if it isn't.
TtyMode DisplayMode = "tty"
// PlainMode is the human-readable plain text output. This mode is not meant to be read
Expand Down Expand Up @@ -152,11 +154,24 @@ func NewDisplay(out console.File, mode DisplayMode, opts ...DisplayOpt) (Display
return newPlainDisplay(out, opts...), nil
case RawJSONMode:
return newRawJSONDisplay(out, opts...), nil
case QuietMode:
return newDiscardDisplay(), nil
default:
return Display{}, errors.Errorf("invalid progress mode %s", mode)
}
}

type discardDisplay struct{}

func newDiscardDisplay() Display {
return Display{disp: &discardDisplay{}}
}

func (d *discardDisplay) init(displayLimiter *rate.Limiter) {}
func (d *discardDisplay) update(ss *client.SolveStatus) {}
func (d *discardDisplay) refresh() {}
func (d *discardDisplay) done() {}

type consoleDisplay struct {
t *trace
disp *ttyDisplay
Expand Down