What I'm looking to accomplish is have something trigger a git add *.txt and git commit -m "Automated Commit `date`' when I close Notational Velocity. I'm guessing I could probably accomplish this with an AppleScript but I don't know the language well enough. I looked into creating a launchd plist that would watch the main database file and that didn't seem to cause it to trigger a commit at all. Does anyone know of a good way to accomplish this?
2 Answers
You can use Keyboard Maestro to completely automate the task. Here's a screenshot of a macro doing just that :
You should adapt the bash script to suit your needs, I'm not sure how to include the date in the commit message (in addition, I forgot to put the git add command).
Create a bash script with
#!/bin/bash
cd /path/to/notational/velocity/folder
NOW=$(date +"%m-%d-%Y")
git add *.txt
git commit -m "Automated commit $NOW"
killall NotationVelocity # or whatever its name is
Then save the script, make it executable with
chmod +x name of the script
and when you want to close NV, just double-click the script.