Skip to content

Instantly share code, notes, and snippets.

@ta1kt0me
Last active March 23, 2017 09:39
Show Gist options
  • Select an option

  • Save ta1kt0me/6503f70bdd55164842afe5c8a0518634 to your computer and use it in GitHub Desktop.

Select an option

Save ta1kt0me/6503f70bdd55164842afe5c8a0518634 to your computer and use it in GitHub Desktop.
notify when complete command via terminal-notifier
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