mirror of
https://github.com/restic/restic.git
synced 2025-10-09 13:49:58 +00:00
backup: extract StdioWrapper from ProgressPrinters
The StdioWrapper is not used at all by the ProgressPrinters. It is called a bit earlier than previously. However, as the password prompt directly accessed stdin/stdout this doesn't cause problems.
This commit is contained in:
@@ -15,7 +15,6 @@ import (
|
||||
// JSONProgress reports progress for the `backup` command in JSON.
|
||||
type JSONProgress struct {
|
||||
*ui.Message
|
||||
*ui.StdioWrapper
|
||||
|
||||
term *termstatus.Terminal
|
||||
v uint
|
||||
@@ -27,10 +26,9 @@ var _ ProgressPrinter = &JSONProgress{}
|
||||
// NewJSONProgress returns a new backup progress reporter.
|
||||
func NewJSONProgress(term *termstatus.Terminal, verbosity uint) *JSONProgress {
|
||||
return &JSONProgress{
|
||||
Message: ui.NewMessage(term, verbosity),
|
||||
StdioWrapper: ui.NewStdioWrapper(term),
|
||||
term: term,
|
||||
v: verbosity,
|
||||
Message: ui.NewMessage(term, verbosity),
|
||||
term: term,
|
||||
v: verbosity,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@ package backup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -22,10 +21,6 @@ type ProgressPrinter interface {
|
||||
Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool)
|
||||
Reset()
|
||||
|
||||
// ui.StdioWrapper
|
||||
Stdout() io.WriteCloser
|
||||
Stderr() io.WriteCloser
|
||||
|
||||
P(msg string, args ...interface{})
|
||||
V(msg string, args ...interface{})
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ package backup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -45,9 +44,6 @@ func (p *mockPrinter) Finish(id restic.ID, _ time.Time, summary *Summary, dryRun
|
||||
|
||||
func (p *mockPrinter) Reset() {}
|
||||
|
||||
func (p *mockPrinter) Stdout() io.WriteCloser { return nil }
|
||||
func (p *mockPrinter) Stderr() io.WriteCloser { return nil }
|
||||
|
||||
func (p *mockPrinter) P(msg string, args ...interface{}) {}
|
||||
func (p *mockPrinter) V(msg string, args ...interface{}) {}
|
||||
|
||||
|
@@ -14,7 +14,6 @@ import (
|
||||
// TextProgress reports progress for the `backup` command.
|
||||
type TextProgress struct {
|
||||
*ui.Message
|
||||
*ui.StdioWrapper
|
||||
|
||||
term *termstatus.Terminal
|
||||
}
|
||||
@@ -25,9 +24,8 @@ var _ ProgressPrinter = &TextProgress{}
|
||||
// NewTextProgress returns a new backup progress reporter.
|
||||
func NewTextProgress(term *termstatus.Terminal, verbosity uint) *TextProgress {
|
||||
return &TextProgress{
|
||||
Message: ui.NewMessage(term, verbosity),
|
||||
StdioWrapper: ui.NewStdioWrapper(term),
|
||||
term: term,
|
||||
Message: ui.NewMessage(term, verbosity),
|
||||
term: term,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user