mirror of
https://github.com/restic/restic.git
synced 2025-08-12 17:07:40 +00:00
backup: Disable status output for --quiet
This commit is contained in:
@@ -44,8 +44,9 @@ type fder interface {
|
||||
// a file (e.g. via shell output redirection) or is just an io.Writer (not the
|
||||
// open *os.File for stdout), no status lines are printed. The status lines and
|
||||
// normal output (via Print/Printf) are written to wr, error messages are
|
||||
// written to errWriter.
|
||||
func New(wr io.Writer, errWriter io.Writer) *Terminal {
|
||||
// written to errWriter. If disableStatus is set to true, no status messages
|
||||
// are printed even if the terminal supports it.
|
||||
func New(wr io.Writer, errWriter io.Writer, disableStatus bool) *Terminal {
|
||||
t := &Terminal{
|
||||
wr: bufio.NewWriter(wr),
|
||||
errWriter: errWriter,
|
||||
@@ -54,6 +55,10 @@ func New(wr io.Writer, errWriter io.Writer) *Terminal {
|
||||
status: make(chan status),
|
||||
}
|
||||
|
||||
if disableStatus {
|
||||
return t
|
||||
}
|
||||
|
||||
if d, ok := wr.(fder); ok && canUpdateStatus(d.Fd()) {
|
||||
// only use the fancy status code when we're running on a real terminal.
|
||||
t.canUpdateStatus = true
|
||||
|
Reference in New Issue
Block a user