Compare commits

..

2 Commits

Author SHA1 Message Date
Audrey 8640f56437 a bit of safety 2026-10-02 13:36:59 -07:00
Audrey 8c7a3c68fd phrasing! 2026-10-02 13:36:59 -07:00
1 changed files with 5 additions and 5 deletions

View File

@ -57,21 +57,21 @@ EOF
case "$1" in case "$1" in
--cron) timer="cron $2"; shift 2 ;; --cron) timer="cron $2"; shift 2 ;;
--systemd) timer="systemd $2"; shift 2 ;; --systemd) timer="systemd $2"; shift 2 ;;
--dir) kind=dir; prefix="$(realpath "$2")"; shift 2 ;; --dir) kind=dir; prefix="$(realpath "$2" 2>/dev/null)" || prefix="$2"; shift 2 ;;
--url) kind=url; prefix="$2"; shift 2 ;; --url) kind=url; prefix="$2"; shift 2 ;;
--appid) kind=appid; prefix="$2"; shift 2 ;; --appid) kind=appid; prefix="$2"; shift 2 ;;
*) usage; return 1 ;; *) usage; return 1 ;;
esac esac
done done
while [[ "$prefix" == /* ]]; do
prefix="${prefix#/}"
done
if [[ -z "$prefix" || -z "$timer" ]]; then if [[ -z "$prefix" || -z "$timer" ]]; then
usage usage
return 1 return 1
fi fi
while [[ "$prefix" == /* ]]; do
prefix="${prefix#/}"
done
if [[ -n "${CWDCONTROL_SETTINGS["$kind /$prefix"]}" ]]; then if [[ -n "${CWDCONTROL_SETTINGS["$kind /$prefix"]}" ]]; then
echo "Warning: ${orig[*]} is a duplciate" echo "Warning: cwdcontrol-disallow ${orig[*]} is a duplciate"
fi fi
CWDCONTROL_SETTINGS["$kind /$prefix"]="$timer" CWDCONTROL_SETTINGS["$kind /$prefix"]="$timer"
return 0 return 0