github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/fly/ui/ui.go (about) 1 package ui 2 3 import ( 4 "io" 5 "os" 6 "runtime" 7 8 colorable "github.com/mattn/go-colorable" 9 isatty "github.com/mattn/go-isatty" 10 ) 11 12 var Stderr = colorable.NewColorableStderr() 13 14 func ForTTY(dst io.Writer) (io.Writer, bool) { 15 isTTY := false 16 if file, ok := dst.(*os.File); ok && isatty.IsTerminal(file.Fd()) { 17 isTTY = true 18 if runtime.GOOS == "windows" { 19 dst = colorable.NewColorable(file) 20 } 21 } 22 23 return dst, isTTY 24 }