commit cb4997e7af61b423d79129b6b19bf9ddfe10034f parent 13517aa054b007b984196eca8a977d5c9f0da5d2 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 27 Feb 2020 09:20:11 +0100 Condense option case statements Diffstat:
M | .local/bin/radio | | | 9 | +-------- |
M | .local/bin/template.sh | | | 15 | +++++---------- |
2 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/.local/bin/radio b/.local/bin/radio @@ -14,14 +14,7 @@ WBGO" lines=10 prompt="station: " -if [ -z "$TERM" ]; then - t="$(printf '%s' "$n" | dmenu -i -l "$lines" -p "$prompt")" -else - t="$(printf '%s' "$n" | fzy -l "$lines" -p "$prompt")" -fi -if [ -z "$t" ]; then - exit 1 -fi +t="$(printf '%s' "$n" | imenu -i -l "$lines" -p "$prompt")" case "$t" in bitreich) diff --git a/.local/bin/template.sh b/.local/bin/template.sh @@ -31,22 +31,17 @@ while :; do case "$1" in -h) show_help - exit 0 - ;; + exit 0;; -v) show_version - exit 0 - ;; + exit 0;; -V) - verbose=1 - ;; + verbose=1;; --) # end all options shift - break - ;; + break;; -?*) - die 'unknown option specified' - ;; + die 'unknown option specified';; *) # No more options break esac