Created
May 23, 2015 20:50
-
-
Save JesseHerrick/1078218979327b373919 to your computer and use it in GitHub Desktop.
write() function for writing articles
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
#!/usr/bin/env bash | |
write() { | |
command="$@" | |
# run the command | |
$@ | |
# special command exec stuff | |
case $command in | |
# git commit | |
*commit*) | |
commit_message=`git log -1 --pretty=%B` | |
git_diff=`git diff @~..@` | |
echo "\nCOMMIT: $commit_message\n$git_diff\nENDCOMMIT\n" >> $HOME/Desktop/history.txt | |
;; | |
# any other command | |
*) | |
echo "\$ $command" >> $HOME/Desktop/history.txt | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment