-
-
Save markryall/712adecd62b906b9deb26ba6467682ab to your computer and use it in GitHub Desktop.
make run | bash ~/Downloads/lmk
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
DONE_PATTERN="${1:-"bundle is now VALID"}" | |
# | |
PROGRESS_PATTERN="${3:-"bundle is now INVALID"}" | |
# | |
ERROR_PATTERN="${3:-"ERROR"}" | |
main() { | |
tee >(update_status) | |
} | |
update_status() { | |
while read line | |
do | |
if [[ "$line" =~ "$DONE_PATTERN" ]]; then | |
if [ $HAS_ERROR -eq 0 ]; then | |
terminal-notifier -group calypso -sound Submarine -message done! | |
else | |
terminal-notifier -sound Basso -group calypso -message yikes! | |
fi | |
elif [[ "$line" =~ "$PROGRESS_PATTERN" ]]; then | |
terminal-notifier -sound Bottle -group calypso -message starting! | |
HAS_ERROR=0 | |
set_icon "$PROGRESS_COLOR" | |
elif [[ "$line" =~ "$ERROR_PATTERN" ]]; then | |
HAS_ERROR=1 | |
# I tried to make the above generic enough but then wanted to also | |
# support `nodemon` in a way that didn't interfere with `make run`, | |
# hence the following mess with the literals: | |
# for npm run test-client:watch | |
elif [[ "$line" =~ "restarting due to changes" ]]; then | |
terminal-notifier -sound Bottle -group calypso -message starting! | |
elif [[ "$line" =~ "app crashed" ]]; then | |
terminal-notifier -sound Bottle -group calypso -message starting! | |
fi | |
done | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment