Created
February 27, 2020 15:20
-
-
Save shapr/bb14208c94a4c2b78c6d461830327eda to your computer and use it in GitHub Desktop.
my try command wrapper, updated for mac
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
# for long running commands | |
function try () { | |
tally $* && fin || die; # cargo install tally, replacement for time | |
} | |
function play_sound () { | |
afplay $HOME/.bin/$1.wav | |
} | |
function notify_success() { | |
osascript -e 'tell app "System Events" to display alert "Task Successful" message "Your task succeeded."' | |
} | |
function notify_failure() { | |
osascript -e 'tell app "System Events" to display alert "Task Failure" message "Your task has failed."' | |
} | |
function fin () { | |
notify_success | |
play_sound monkey # monkey.wav from XEmacs https://bitbucket.org/xemacs/sounds-wav/src | |
} | |
function die() { | |
notify_failure | |
play_sound yeep # yeep.wav from XEmacs https://bitbucket.org/xemacs/sounds-wav/src | |
play_sound yeep | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment