summaryrefslogtreecommitdiff
path: root/vendor/github.com/mattn/go-colorable/colorable_others.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mattn/go-colorable/colorable_others.go')
-rw-r--r--vendor/github.com/mattn/go-colorable/colorable_others.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/vendor/github.com/mattn/go-colorable/colorable_others.go b/vendor/github.com/mattn/go-colorable/colorable_others.go
index 887f203dc..08cbd1e0f 100644
--- a/vendor/github.com/mattn/go-colorable/colorable_others.go
+++ b/vendor/github.com/mattn/go-colorable/colorable_others.go
@@ -10,7 +10,7 @@ import (
_ "github.com/mattn/go-isatty"
)
-// NewColorable return new instance of Writer which handle escape sequence.
+// NewColorable returns new instance of Writer which handles escape sequence.
func NewColorable(file *os.File) io.Writer {
if file == nil {
panic("nil passed instead of *os.File to NewColorable()")
@@ -19,12 +19,20 @@ func NewColorable(file *os.File) io.Writer {
return file
}
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
+// NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.
func NewColorableStdout() io.Writer {
return os.Stdout
}
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
+// NewColorableStderr returns new instance of Writer which handles escape sequence for stderr.
func NewColorableStderr() io.Writer {
return os.Stderr
}
+
+// EnableColorsStdout enable colors if possible.
+func EnableColorsStdout(enabled *bool) func() {
+ if enabled != nil {
+ *enabled = true
+ }
+ return func() {}
+}