mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 06:46:34 +00:00
ui, termstatus: Move WrapStdio
Saves some imports. ui still needs to import ui/termstatus from message.go.
This commit is contained in:
parent
0b56214473
commit
66d03c797e
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/ui"
|
|
||||||
"github.com/restic/restic/internal/ui/termstatus"
|
"github.com/restic/restic/internal/ui/termstatus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ func setupTermstatus() (*termstatus.Terminal, func()) {
|
|||||||
|
|
||||||
// use the termstatus for stdout/stderr
|
// use the termstatus for stdout/stderr
|
||||||
prevStdout, prevStderr := globalOptions.stdout, globalOptions.stderr
|
prevStdout, prevStderr := globalOptions.stdout, globalOptions.stderr
|
||||||
globalOptions.stdout, globalOptions.stderr = ui.WrapStdio(term)
|
globalOptions.stdout, globalOptions.stderr = termstatus.WrapStdio(term)
|
||||||
|
|
||||||
return term, func() {
|
return term, func() {
|
||||||
// shutdown termstatus
|
// shutdown termstatus
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package ui
|
package termstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/ui/termstatus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// WrapStdio returns line-buffering replacements for os.Stdout and os.Stderr.
|
// WrapStdio returns line-buffering replacements for os.Stdout and os.Stderr.
|
||||||
// On Close, the remaining bytes are written, followed by a line break.
|
// On Close, the remaining bytes are written, followed by a line break.
|
||||||
func WrapStdio(term *termstatus.Terminal) (stdout, stderr io.WriteCloser) {
|
func WrapStdio(term *Terminal) (stdout, stderr io.WriteCloser) {
|
||||||
return newLineWriter(term.Print), newLineWriter(term.Error)
|
return newLineWriter(term.Print), newLineWriter(term.Error)
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package ui
|
package termstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
Loading…
Reference in New Issue
Block a user