I was reminded by Simon Støvring, maker of the excellent Mac and iOS utility Data Jar (which is a persistent data store that’s accessible via Shortcuts), that people may not be aware of just how well integrated Shortcuts is into macOS.
For example, if you’re someone who works in the Terminal a lot, you may not realize that you can integrate Shortcuts (including accessing data from apps like Data Jar) directly into your shell scripts and commands via the shortcuts command-line app.
I created a small example shortcut called songtitle that outputs the title of the currently playing song.
Now from Terminal, I can use that output in any way you would normally process data. If I want to open the result in BBEdit, for example, I’d type:
``` shortcuts run songtitle | bbedit
```
If I wanted to output the result to a file, I can use the -o flag to direct the output:
``` shortcuts run songtitle -o ~/songtitle.txt
```
And if I just want to see the output, I can pipe the result to cat:
``` shortcuts run songtitle | cat
```
By the way, shortcuts will also provide command-line access to the names of all your available shortcuts by typing shortcuts list.…