Thank you Jean, That was very helpful and I was able to get it working with a few adjustments.
Do you have recommendations on learning more about shell scripting and setting up some of these types of command line tools to work with BBEdit? On Thursday, December 29, 2022 at 2:30:43 AM UTC-5 jj wrote: > In case you want to close the terminal and stay in BBEdit, you can create > a shell script in ~/Library/Application\ > Support/BBEdit/Scripts/php-cs-fixer-example.sh > (Adapt php-cs-fixer's path as per your configuration) : > > #!/usr/bin/env sh > /opt/homebrew/bin/php-cs-fixer fix --rules=no_whitespace_in_blank_line > -- "$BB_DOC_PATH" ; > > And apply it to the front document from the BBEdit's Script menu. > > HTH, > > Jean Jourdain > On Thursday, December 29, 2022 at 4:58:46 AM UTC+1 [email protected] > wrote: > >> Thank you! I came here wondering why a text filter wasn't working, but it >> did when run in terminal. Mine was the same issue. I was passing the text >> contents instead of the file which php-cs-fixer expects. Oh well, guess >> I'll just keep terminal open when needed. >> >> On Tuesday, December 20, 2022 at 10:01:20 AM UTC-5 [email protected] >> wrote: >> >>> I haven't used beautysh but it looks like it's expecting to be passed >>> the name/path of a file to operate on, and rewrites the file in place? >>> >>> A text filter, on the other hand, is passed the contents of the file you >>> run it against, in the standard input (sys.stdin in Python). >>> >>> So you may need to adapt the module interface mentioned in the docs >>> ("You can also call beautysh as a module") in order to use it as a text >>> filter. >>> >>> --Kevin >>> >>> On Tue, Dec 20, 2022 at 9:24 AM Greg Raven <[email protected]> wrote: >>> >>>> I have a couple of Bash-language text filters that work great. I just >>>> tried to create a new one, which instead of working as expected generates >>>> an error message. >>>> >>>> Here's the code: >>>> >>>> ``` >>>> #!/bin/sh >>>> >>>> ## requires macOS CommandLineTools >>>> ## requires pip3 install beautysh >>>> >>>> python3 ~/Library/Python/3.9/bin/beautysh >>>> ``` >>>> When I run beautysh from the command line, it seems to work fine, just >>>> like my text filter that employs css-beautity, js-beautify, and json.tool >>>> and uses similar coding. >>>> >>>> Can anyone shed any light on this? >>>> >>>> -- >>>> 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/b58483e7-bf67-4e06-899c-a506a2ed88fcn%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/bbedit/b58483e7-bf67-4e06-899c-a506a2ed88fcn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- 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/7798c8e5-1cba-4a48-9f3a-8524c6ca7959n%40googlegroups.com.
