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:
Olivier Mengué 2023-03-21 22:15:09 +01:00
parent 11a925cff3
commit d9a68d5943
2 changed files with 2 additions and 40 deletions

View File

@ -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() {}
}

View File

@ -1,5 +1,5 @@
//go:build !windows && !appengine
// +build !windows,!appengine
//go:build !windows || appengine
// +build !windows appengine
package colorable