I’ve created a command line utility called hook that brings a lot of Hooks power to the terminal. You can find it at https://github.com/ttscoff/hookapp where you’ll also find installation instructions. Spoiler, it’s a ruby gem and you can install it by simply running gem install hookapp (you may need sudo gem install hookapp depending on your setup).
The main command is hook and it’s built to use subcommands, a la git. All commands are detailed under hook help, and you can get details on a specific command using hook help COMMAND.
There’s some brief documentation on the GitHub page as well.
You can let me know how it goes here or in the Issues section of the GitHub repo.
Fantastic! CLI was one of my early internal feature request for Hook as SLC product ( Simple Lovable Complete product, as opposed to MVP.). How fitting that it should be Brett Terpstra himself who delivers the goods!
One of us here at CogSci Apps has tried your CLI and happily reports success! She notes , it return an error message when the url is invalid
error: no implicit conversion of false into String
The following commands not working:
hook clip
“bear://x-callback-url/open-note?id=C24C1EEB-F5FF-4B06-B033-BB2A19BFA2EB-877-0000016BBABE4FFC”
hook clip nvalt://find//?NV=FGNrz%2BwTQlSmGLofWgauqQ%3D%3D
for the above types of urls, hook select , hook list also not working
I just pushed v0.0.3 to both the gem server and to GitHub. Should fix usage with all urls. I think it should fix the “conversion of false to string” issue as well, though I probably should have tested that further before this release. Next one!
The latest version of the gem with Hook 2.0 compatibility (2.0.3) is live now. Use gem install hookapp (or gem update hookapp if already installed). Note that, depending on your Ruby setup, you may need to use sudo gem....
Just wanted to thank you for this. I’ve been recently toying with Task Warrior and wanted the ability to call hooks with taskopen. This did the trick beautifully.
Thanks for making this! It works really well with Hazel and 2Do’s URL scheme. I made a rule in Hazel to watch a folder of text files for the string @todo and then create a 2Do task once one appears. This is the embedded script in Hazel that I managed to get working after some trial and error.
hook clip $1
HOOKLINK=$(pbpaste)
LONG_FILENAME="$1"
SHORT_NAME=$(basename "$LONG_FILENAME")
open "twodo://x-callback-url/add?task=$SHORT_NAME&type=0&forlist=Inbox&tags=hooked&action=url:$HOOKLINK"