aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-05-13 15:22:34 +0200
committerWynn Wolf Arbor2020-05-13 15:22:34 +0200
commit10b1d754142254727c6f47259c927f10681656d0 (patch)
tree67c7ab1b0b56ef24c50cdffa0d320718084c62a8
parent4579c8411ef7dae1ac871555a19f1bfbfae5b54c (diff)
downloadbosun-10b1d754142254727c6f47259c927f10681656d0.tar.gz
Simplify handling of default actions
Instead of using a catchall pattern for `case`, assign a default value to the variable in question. This helps reduce the amount of special cases - especially considering the addition of better error reporting in an upcoming commit.
Diffstat (limited to '')
-rwxr-xr-xbosun6
1 files changed, 2 insertions, 4 deletions
diff --git a/bosun b/bosun
index b462b6b..c195176 100755
--- a/bosun
+++ b/bosun
@@ -34,12 +34,11 @@ rebuild() {
}
list() {
- subcmd="$1"
+ subcmd="${1:-active}"
case $subcmd in
active) list_active;;
all) list_all;;
available) list_available;;
- *) list_active;;
esac
}
@@ -64,7 +63,7 @@ list_available() {
rm -f "$tmp"
}
-cmd="$1"
+cmd="${1:-list}"
test $# -gt 0 && shift
case $cmd in
add) add "$@";;
@@ -72,5 +71,4 @@ case $cmd in
list) list "$@";;
rebuild) rebuild "$@";;
remove) remove "$@";;
- *) list_active;;
esac