dotfiles/lib/lib.sh

25 lines
338 B
Bash
Raw Normal View History

2023-10-14 22:38:03 +02:00
#!/bin/sh
2023-10-14 22:38:04 +02:00
. ./sync.conf || . ../sync.conf
2023-10-14 22:38:03 +02:00
DRY_RUN=${DRY_RUN:-no}
bool() {
case "$1" in
1|true|yes|on|TRUE|YES|ON) return 0 ;;
*) return 1 ;;
esac
}
run() {
if bool "$DRY_RUN"; then
echo "DRY: + $*"
else
echo "+ $*"
"$@"
fi
}
2023-10-14 22:38:04 +02:00
is_graphical() {
command -v $PREF_TERM && return 0 || return 1
}