Open cardil opened 1 year ago
The NewColorable func forces users to pass a *os.File. It should accept io.Writer instead. The func could verify if a given writer is a real TTY, and act accordingly.
NewColorable
*os.File
io.Writer
Why do you need this?
Why is the following function not enough?
func setColorable(w io.Writer) io.Writer { if f, isFile := w.(*os.File); isFile { return colorable.NewColorable(f) } return w }
The
NewColorable
func forces users to pass a*os.File
. It should acceptio.Writer
instead. The func could verify if a given writer is a real TTY, and act accordingly.