-
-
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
Allow configuring show_nonprintable from PrettyPrinter #2142
Conversation
Thank you! Looks good to me. Would you mind adding an entry about it to CHANGELOG.md please? |
No worries at all! And I've added an entry to the changelog. 👍 |
Co-authored-by: Martin Nordholts <enselic@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
I don't think this has been discussed, no. I agree that this should be improved. The "content from READER" part isn't great either 😄. It would be good if you could open a new ticket for this. Thanks! |
No worries, I've done so here: #2146 |
This PR allows crates using
bat
as a library to configure theshow_nonprintable
setting via thePrettyPrinter
API.Note that it is possible to use
bat
as a lib and configure this, but the workaround requires usingbat
's "inner" API which is discouraged bybat
's documentation.Current workaround:
Once this PR is merged, consumers will be able to do this:
Something else noteworthy: if using
bat
as a library, if binary content is detected then thePrettyPrinter
will print:I'm not sure if this has been discussed previously, but I imagine it could cause some surprise for crates which depend on
bat
since the-A
flag obviously isn't available, etc.