Hi Maxime, Passing the --quiet flag seems to do the trick.
#!/bin/bash black -q - HTH Jean Jourdain On Sunday, September 5, 2021 at 1:25:20 AM UTC+2 [email protected] wrote: > For reference, I ended up using Black's (private) method format_str() > like so: > > #!/usr/bin/env python3 > > import sys > from black import format_str > from black.mode import Mode > > stdin = sys.stdin.read() > stdout = format_str(stdin, mode=Mode()) > > print(stdout, end="") > > Still, it would be nice to know what's wrong with the previous code. > > On Saturday, September 4, 2021 at 6:02:36 PM UTC-4 Maxime Pigeon wrote: > >> Hi, >> >> I'm trying to create a very simple text filter that uses Black to format >> Python code. According to their documentation >> <https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#standard-input>, >> >> Black supports formatting code via stdin, with the result being printed to >> stdout. So my text filter is simply: >> >> #!/bin/bash >> >> black - >> >> Script output says that the reformat was successful, yet my file doesn't >> change. Anyone has experience with using Black in BBEdit? >> > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/9b8c08be-3b7e-4872-819c-e64127ac7980n%40googlegroups.com.
