Created
February 16, 2014 08:54
-
-
Save poolik/9031329 to your computer and use it in GitHub Desktop.
Notifications from terminal
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
function notifyDone () { command="$@"; terminal-notifier -title "Terminal" -message "Done with '$command'!" -activate com.googlecode.iterm2; } | |
function notifyError () { command="$@"; terminal-notifier -title "Terminal ERROR!" -message "'$command' exited with error!" -activate com.googlecode.iterm2; } | |
function wn () { ($@ && notifyDone $@) || notifyError $@; } | |
function n () { $@; notifyDone $@;} | |
# Usage: | |
# if command returns 0 on success and non 0 on error: | |
wn git push heroku production:master | |
# else | |
n git push heroku production:master |
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
terminal-notifier -title "First test" -message "Notification from terminal" |
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
alias notifyDone='terminal-notifier -title "Terminal" -message "Done with command!"' | |
alias notifyError='terminal-notifier -title "Terminal ERROR!" -message "Command exited with error"' | |
# Usage: | |
# if command returns 0 on success and non 0 on error: | |
(git push heroku production:master && notifyDone) || notifyError | |
# else | |
git push heroku production:master; notifyDone; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment