api/vendor/github.com/mattn/go-colorable/colorable_others.go

31 lines
645 B
Go
Raw Normal View History

2018-06-10 09:11:41 +00:00
// +build !windows
// +build !appengine
package colorable
import (
"io"
"os"
_ "github.com/mattn/go-isatty"
)
2019-10-23 21:11:40 +00:00
// NewColorable returns new instance of Writer which handles escape sequence.
2018-06-10 09:11:41 +00:00
func NewColorable(file *os.File) io.Writer {
if file == nil {
panic("nil passed instead of *os.File to NewColorable()")
}
return file
}
2019-10-23 21:11:40 +00:00
// NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.
2018-06-10 09:11:41 +00:00
func NewColorableStdout() io.Writer {
return os.Stdout
}
2019-10-23 21:11:40 +00:00
// NewColorableStderr returns new instance of Writer which handles escape sequence for stderr.
2018-06-10 09:11:41 +00:00
func NewColorableStderr() io.Writer {
return os.Stderr
}