You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
527 B
24 lines
527 B
die() {
|
|
# Use notify-send to send errors when not in a terminal
|
|
# [ -t 0 ] only works outside of pipes
|
|
[ -t 0 ] || notify-send "$@" && >&2 echo "$@"
|
|
exit 1
|
|
}
|
|
|
|
# Output error to stderr and to graphical notification
|
|
notify_err() {
|
|
tee /dev/fd/2 | xargs -r -n1 -d "\n" notify-send
|
|
}
|
|
|
|
assert_exists() {
|
|
for c in $@; do
|
|
which "$c" > /dev/null 2>&1 || die "$c doesn't appear to be installed"
|
|
done
|
|
}
|
|
|
|
check_exists() {
|
|
for c in $@; do
|
|
which "$c" > /dev/null 2>&1 || return 1
|
|
done
|
|
}
|
|
|
|
|