-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to check a io.Writer
instead of raw file descriptor
#80
Comments
Also: |
tty should always be checked with Writer. |
Why can't pass raw file? |
When you can pass a |
You can do type assertion before pass to the function like:
|
@mattn wrote:
I disagree. I usually check if |
The time that I had a look at this package I also thought: why not an io.Writer? But after that initial thought, I realized that the current API is very appropriate because:
|
Thanks for your comments. I had the same issue as @cardil and was going to ask how to implement this. Using And that's more than enough for me. My use case is simple: I just wish to check if I'm writing logs to a TTY or to a file, and use coloured output if it's a TTY. Many packages already do that; some don't, and so I have to check if the output is a TTY before using some of the features — but as @dolmen commented, this happens very early in |
The lib allows checking TTY versus a raw file descriptor. It would be convenient to allow checking of a given
io.Writer
instead.Related mattn/go-colorable#65
The text was updated successfully, but these errors were encountered: