open-vault/vendor/github.com/mitchellh/cli/ui_writer.go
Jeff Mitchell 7a4eda156c Migrate to built-in Go vendoring.
This also removes `godep` calls from make scripts. Of note is that
currently `./...` checking in acceptance tests is disabled.
2016-02-18 15:06:02 -05:00

19 lines
349 B
Go

package cli
// UiWriter is an io.Writer implementation that can be used with
// loggers that writes every line of log output data to a Ui at the
// Info level.
type UiWriter struct {
Ui Ui
}
func (w *UiWriter) Write(p []byte) (n int, err error) {
n = len(p)
if n > 0 && p[n-1] == '\n' {
p = p[:n-1]
}
w.Ui.Info(string(p))
return n, nil
}