Created
October 25, 2011 19:53
-
-
Save westonruter/1314028 to your computer and use it in GitHub Desktop.
Using Coda as the editor for SVN/Git commit messages from command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Allows Coda to be used as the editor for writing commit messages. | |
# Add blocking-coda to the PATH along doing chmod u+x on it, and | |
# then set it as your commit message editor by adding to your .profile: | |
# export SVN_EDITOR=blocking-coda | |
# git config --global core.editor blocking-coda | |
# Assumes that you are using iTerm2, which you should! http://www.iterm2.com/ | |
# Once you save the file, iTerm will regain focus. | |
# Tip: when finished writing the commit message, close the file to invoke the | |
# Save File dialog so that the temporary commit message file will be saved | |
# and closed at the same time, since you don't need it anymore. | |
# @author Weston Ruter (@westonruter) | |
initial_mtime=`stat -f %m $1` | |
coda $1 | |
echo "Waiting until the modified time has changed..." | |
while true; do | |
current_mtime=`stat -f %m $1` | |
if [ $current_mtime != $initial_mtime ]; then | |
break | |
fi | |
sleep 1 | |
done | |
# Bring the iTerm back into focus | |
osascript <<APPLESCRIPT | |
tell application "/Applications/iTerm.app" | |
activate | |
end tell | |
APPLESCRIPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment