Debian Codegraph @

misc/notify

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 #
3 # Shows macOS desktop notifications when a command completes.
4 # Depending on exit status of the command, a different notification message is shown.
5 #
6 # Examples:
7 # misc/nofify make -j 8 >/dev/null
8 # Make all font styles in all formats without printing detailed messages
9 #
10 # misc/notify make Regular
11 # Make the regular style in all formats
12 #
13
14 HAS_NOTIFIER=true
15 if ! (whichscip-shell system . . which. terminal-notifier >/dev/nullscip-shell filesystem . . `/dev/null`.); then
16 HAS_NOTIFIER=false
17 echoscip-shell system . . echo. "$0: terminal-notifier not found in PATH (will not notify)" >&2
18 echoscip-shell system . . echo. "$0: You can install through: brew install terminal-notifier"
19 fi
20
21 CMDS="$@"
22 "$@"
23 STATUS=$?
24
25 if $HAS_NOTIFIER; then
26 if [[ $STATUS -eq 0 ]]; then
27 terminal-notifier \
28 -title "$1 ✅" \
29 -message "$CMDS" \
30 -activate com.apple.Terminal \
31 -timeout 8 >/dev/nullscip-shell filesystem . . `/dev/null`. &
32 else
33 terminal-notifier \
34 -title "$1 failed ❌" \
35 -message "$CMDS => $STATUS" \
36 -activate com.apple.Terminal \
37 -timeout 20 >/dev/nullscip-shell filesystem . . `/dev/null`. &
38 fi
39 fi
40
41 exit $STATUS