Skip to content

Instantly share code, notes, and snippets.

@staltz
Created March 7, 2017 13:08
Show Gist options
  • Save staltz/c9c575525bc55043b71f8f0e16b214e3 to your computer and use it in GitHub Desktop.
Save staltz/c9c575525bc55043b71f8f0e16b214e3 to your computer and use it in GitHub Desktop.
Show a macOS notification when a terminal task is done
# Name it whatever you want. I like `y` because in my keyboard layout it's close to `;`
function y() {
previous=$?
if [ $previous -eq 0 ]; then
osascript -e "display notification \"Done\" with title \"Terminal Task\"" && say "it is done";
else
osascript -e "display notification \"Failed\" with title \"Terminal Task\"" && say "it went to the trees";
fi
}
npm test ;y
@zhangchiqing
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment