Ah, it does look like that will work. It's not mentioned in the README but
it is documented in the script:

        parser.add_argument(
>             "files",
>             metavar="FILE",
>             nargs="*",
>             help="Files to be beautified. This is mandatory. "
>             "If - is provided as filename, then beautysh reads "
>             "from stdin and writes on stdout.",
>         )


On Tue, Dec 20, 2022 at 10:27 AM jj <[email protected]> wrote:

> Hi Greg,
>
> If you use your script as a text filter, you should add an hyphen '-'
> after the beautysh command to have stdin as input to the command.
> like so:
>     ...
>     python3 ~/Library/Python/3.9/bin/beautysh -
>     ...
>
> HTH,
>
> Jean Jourdain
>
> On Tuesday, December 20, 2022 at 4:01:20 PM UTC+1 [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/d98670e7-44b5-40e1-a911-d6808d424bfdn%40googlegroups.com
> <https://groups.google.com/d/msgid/bbedit/d98670e7-44b5-40e1-a911-d6808d424bfdn%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/CAKi-cfuo8_eGD07q9sM_QRKKOcpUS2HaYTYnLODQo9mfZRAmUQ%40mail.gmail.com.

Reply via email to