-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Silence warnings #823
Comments
Thank you for your feedback.
This only happens if you disable the "header" component in I am assuming that you have a config file which sets a different default style (or you used the
Yes, this is on purpose. We print warnings to stdout because they would interfere with paging support otherwise. They would be printed "in the background" and would not be visible in the pager output. I guess we could print warnings to stderr if we are not piping to a pager, which would at least solve this particular use case.
That's always an option, but I'd like to avoid introducing a new command-line option, if possible. |
Thanks for your detailed reply! I
I'm pretty much satisfied with your solution, re-enabling headers indeed rids of the warning. My bad for not noticing that.
I won't have time to implement this in the considerable future (I don't know rust), but might one day implement this, if you think there is no better solution. (You can close this if you're not super interested, I'm largely satisfied with how things stand now) |
Thought about this again. I think we'll leave the current behavior. Changing from stdout to stderr when not printing to a pager could lead to other surprising behaviors. |
I use
bat
to preview files in fzf. Whenbat
is called on a binary file, it will display a warning:As you can see, there is no way to silence this warning. For my specific use case, using
bat
as a "previewer", I would rather it be silent than that it displays an "error". Would it be a good idea to make it possible to silence warnings somehow?In terms of implementation, I was thinking one could implement the warnings of
bat
such they are directed to stderr (seemingly, they are directed to stdout now?). In that way, users that don't need the warnings, can redirect stderr to/dev/null
, without a lot of changes tobat
itself. Alternatively, one could add a new switch tobat
, that makes it less verbose in case of warnings.edit:
I'm not sure wether it's customary to print warnings to stderr, btw.
The text was updated successfully, but these errors were encountered: