summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_writer.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_writer.go')
-rw-r--r--vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_writer.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_writer.go b/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_writer.go
new file mode 100644
index 000000000..1e1db3cf6
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_writer.go
@@ -0,0 +1,18 @@
+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
+}