Remove terminal.Writer
terminal.Writer is now just a wrapper around stdio.Stdout() without
any useful functionality. Replace it with stdio.Stdout() as an
io.Writer.
Test: ui/terminal/status_test.go
Change-Id: I5bc5476afdca950b505642f0135a3af9d37fbe24
diff --git a/ui/terminal/smart_status.go b/ui/terminal/smart_status.go
index 5edc21a..a52fdc2 100644
--- a/ui/terminal/smart_status.go
+++ b/ui/terminal/smart_status.go
@@ -16,6 +16,7 @@
import (
"fmt"
+ "io"
"strings"
"sync"
@@ -23,7 +24,7 @@
)
type smartStatusOutput struct {
- writer Writer
+ writer io.Writer
formatter formatter
lock sync.Mutex
@@ -34,7 +35,7 @@
// NewSmartStatusOutput returns a StatusOutput that represents the
// current build status similarly to Ninja's built-in terminal
// output.
-func NewSmartStatusOutput(w Writer, formatter formatter) status.StatusOutput {
+func NewSmartStatusOutput(w io.Writer, formatter formatter) status.StatusOutput {
return &smartStatusOutput{
writer: w,
formatter: formatter,
@@ -133,7 +134,7 @@
// Run this on every line in case the window has been resized while
// we're printing. This could be optimized to only re-run when we get
// SIGWINCH if it ever becomes too time consuming.
- if max, ok := s.writer.termWidth(); ok {
+ if max, ok := termWidth(s.writer); ok {
if len(str) > max {
// TODO: Just do a max. Ninja elides the middle, but that's
// more complicated and these lines aren't that important.