mirror of
https://github.com/mattn/go-colorable.git
synced 2025-01-22 20:40:22 +08:00
Merge colorable_appengine.go into colorable_others.go
The only difference between colorable_appengine.go and colorable_others.go was the build tags. So let's merge code, preserving build tags.
This commit is contained in:
parent
11a925cff3
commit
d9a68d5943
@ -1,38 +0,0 @@
|
||||
//go:build appengine
|
||||
// +build appengine
|
||||
|
||||
package colorable
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
_ "github.com/mattn/go-isatty"
|
||||
)
|
||||
|
||||
// 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()")
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
// NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.
|
||||
func NewColorableStdout() io.Writer {
|
||||
return os.Stdout
|
||||
}
|
||||
|
||||
// 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() {}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
//go:build !windows && !appengine
|
||||
// +build !windows,!appengine
|
||||
//go:build !windows || appengine
|
||||
// +build !windows appengine
|
||||
|
||||
package colorable
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user