Hacker News new | past | comments | ask | show | jobs | submit login

You can use Automator to create a service with a shell script action; just pick Quick Action, the rest should be pretty obvious.



Not so obvious to me ! I have created the Quick Action but I don't know how to trigger it, so I have saved it as an app. Also when I execute it from Automator (play button), the script doesn't work (nothing is pasted). Would you mind helping ? Looks the best way to quickly format a copied json ! Thanks


Yeah, that was a very terse explanation, and Automator is so user-friendly it's hard to use.

1. Start Automator.

2. In the "Choose a type..." sheet, choose "Quick Action".

3. Set these:

     Workflow recieves "current text" in "any application".
     Input is "entire selection". [X] Output replaces text.
4. Add "Run shell script" and select your preferred shell.

     jq .
(Note that Automator is handling your stdin / stdout.)

5. File / Save.

You can now find your workflow by command-clicking the document name in the window's titlebar. It should be in /Users/You/Library/Services

Now, fire up TextEdit, enter some JSON. Right-click, select Services and your service should be present. It's also in the TextEdit menu under Services.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: