1
0
mirror of https://github.com/beego/bee.git synced 2025-07-05 08:00:18 +00:00

Updated vendor

This commit is contained in:
Ruben Cid
2019-04-15 16:43:01 +02:00
parent 33dd897647
commit da91d50ab8
134 changed files with 4988 additions and 2530 deletions

View File

@ -0,0 +1,35 @@
package terminal
import (
"io"
"os"
"strings"
"syscall"
"github.com/mattn/go-colorable"
)
// getColorableWriter will return a writer that is capable
// of interpreting ANSI escape codes for terminal colors.
func getColorableWriter() io.Writer {
if strings.ToLower(os.Getenv("ConEmuANSI")) == "on" {
// The ConEmu terminal is installed. Use it.
return os.Stdout
}
const ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
h, err := syscall.GetStdHandle(syscall.STD_OUTPUT_HANDLE)
if err != nil {
return os.Stdout
}
var m uint32
err = syscall.GetConsoleMode(h, &m)
if err != nil {
return os.Stdout
}
if m&ENABLE_VIRTUAL_TERMINAL_PROCESSING != 0 {
return os.Stdout
}
return colorable.NewColorableStdout()
}