19 lines
724 B
Plaintext
Executable File
19 lines
724 B
Plaintext
Executable File
# Use like this
|
|
# some-command && sleep 1 ; alert-me -s -t -f --success-message --success-title --failure-message --failure-title --title
|
|
# osascript -e 'display notification "The command worked" with title "Success"'
|
|
# osascript -e 'display notification "The command failed" with title "Failed"'
|
|
alert-me(){
|
|
local SUCCESS_MESSAGE="The command worked"
|
|
local SUCCESS_TITLE="Success"
|
|
local FAILURE_MESSAGE="The command failed"
|
|
local FAILURE_TITLE="Failed"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
osascript -e "display notification \"$SUCCESS_MESSAGE\" with title \"$SUCCESS_TITLE\""
|
|
else
|
|
|
|
osascript -e "display notification \"$FAILURE_MESSAGE\" with title \"$FAILURE_TITLE\""
|
|
fi
|
|
}
|