Abort on unknown action

This commit is contained in:
dabruh 2022-10-21 23:15:25 +02:00
parent 7e4f0927bf
commit f11281a3e6
1 changed files with 1 additions and 0 deletions

View File

@ -10,6 +10,7 @@ DMENU_ARGS="-i -nb #e74c3c -nf #303030 -sb #c0392b -sf #ecf0f1"
COMMANDS="$(i3exit commands | sed 's/\,/\ /g' | sed 's/.*/\L&/; s/[a-z]*/\u&/g')" COMMANDS="$(i3exit commands | sed 's/\,/\ /g' | sed 's/.*/\L&/; s/[a-z]*/\u&/g')"
ACTION="$(xargs -n 1 <<<"$COMMANDS" | dmenu $DMENU_ARGS -p "exitctl")" ACTION="$(xargs -n 1 <<<"$COMMANDS" | dmenu $DMENU_ARGS -p "exitctl")"
[ -z "$ACTION" ] && exit 1 [ -z "$ACTION" ] && exit 1
i3exit commands | tr ',' '\n' | grep -q "^$ACTION$" || exit 1
echo "INFO: Selected action $ACTION." echo "INFO: Selected action $ACTION."
CONFIRMATION="$(xargs -n 1 <<<"Yes No" | dmenu $DMENU_ARGS -p "Are you sure you want to ${ACTION,,}?")" CONFIRMATION="$(xargs -n 1 <<<"Yes No" | dmenu $DMENU_ARGS -p "Are you sure you want to ${ACTION,,}?")"