Hi All,

I have a script, shown below, that allows me to put the cursor on a single 
line of json and call my script.  A terminal window is opened, and the 
formatted json is shown.  I then can copy it out and paste it back into the 
document.

It works, but it's still a bit of a bother.

I'd like the json line in BBEdit to be replaced with the formatted json. 
 No terminal window needed.

Currently, the script uses the 'jq' tool from 
here: https://stedolan.github.io/jq/

----------Script jqpretty------------------

*tell* *application* "BBEdit"

*set* the_selection *to* (selection *of* *front* *window* *as* *string*)

*if* (the_selection) *is* "" *then*

*set* the_selection *to* *line* (*get* startLine *of* selection) *of* 
*front* *window* *as* *string*

*end* *if*

*end* *tell*


*tell* *application* "Terminal"

*do script* with command "echo '" & the_selection & "' | jq ." in *window* 1

*end* *tell*
----------------------------------------------

Thanks!

-Ken

-- 
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/27a446d9-1f14-4399-b074-45a85f7adb23%40googlegroups.com.

Reply via email to