Last active
March 23, 2017 09:39
-
-
Save ta1kt0me/6503f70bdd55164842afe5c8a0518634 to your computer and use it in GitHub Desktop.
notify when complete command via terminal-notifier
This file contains hidden or 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 __what_command_execute() { | |
| local cmd=$1 | |
| export __NOTIFY_COMMAND="$cmd" | |
| } | |
| function __notify_complete_command() { | |
| local cmd=$__NOTIFY_COMMAND | |
| if [[ $cmd =~ "(be |bundle exec |bin/)rspec|(rails test)" ]] || | |
| [[ $cmd =~ "(npm (test|install|run)|^mocha)" ]] || | |
| [[ $cmd =~ "rails db:(migrate|reset|seed_fu)" ]]; then | |
| terminal-notifier -title "😎$MATCH" -message "💚Complete" -sound Submarine -timeout 10 -activate "com.googlecode.iterm2" | |
| fi | |
| unset __NOTIFY_COMMAND | |
| } | |
| if which terminal-notifier >/dev/null 2>&1; then | |
| add-zsh-hook preexec __what_command_execute | |
| add-zsh-hook precmd __notify_complete_command | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment