Skip to content

Commit f213fa1

Browse files
committed
chore: simplify if
feat: also allow long-form arg
1 parent bad4a47 commit f213fa1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

dunstctl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ show_help() {
3030
notification with given ID
3131
history-rm ID Remove the notification from
3232
history with given ID.
33-
is-paused [-e] Check if pause level is greater than 0, optionally with exit code instead of text output
33+
is-paused [-e|--exit-code] Check if pause level is greater than 0, optionally with exit code instead of text output
3434
set-paused true|false|toggle Set the pause status
3535
get-pause-level Get the current pause level
3636
set-pause-level level Set the pause level
@@ -118,17 +118,17 @@ case "${1:-}" in
118118
;;
119119
"is-paused")
120120
exit=false
121-
if [ "${2:-}" = "-e" ]; then
122-
exit=true
123-
fi
121+
case "${2:-}" in
122+
-e | --exit-code)
123+
exit=true
124+
;;
125+
esac
124126
property_get paused | {
125127
read -r _ _ paused
126128
if [ "$exit" = "false" ]; then
127129
printf "%s\n" "${paused}"
128-
else
129-
if [ "${paused}" = "false" ]; then
130-
exit 1
131-
fi
130+
elif [ "${paused}" = "false" ]; then
131+
exit 1
132132
fi
133133
}
134134
;;

0 commit comments

Comments
 (0)