diff options
author | sinanmohd <sinan@firemail.cc> | 2023-06-01 10:29:49 +0530 |
---|---|---|
committer | sinanmohd <sinan@firemail.cc> | 2023-06-01 10:37:10 +0530 |
commit | a03c66ea31c19118fe2aa89b41fa6aca14e605b6 (patch) | |
tree | b3a3333e9d8763af7acf70622fccb47cdc9cde18 /.local/bin/wobload | |
parent | 37a40ad9a5d85a6f6151a3409f1a9dcf630f7be6 (diff) |
wobload: spring cleaning: redundant lines, errmsg to stderr, ...
Diffstat (limited to '.local/bin/wobload')
-rwxr-xr-x | .local/bin/wobload | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/.local/bin/wobload b/.local/bin/wobload index ff3a2b1..0d8b121 100755 --- a/.local/bin/wobload +++ b/.local/bin/wobload @@ -18,7 +18,7 @@ err() { : "${1:?}" - printf "\033[31;1merr: %b\033[0m\n" "$1" + printf "\033[31;1merr: %b\033[0m\n" "$1" 1>&2 command -v notify-send > /dev/null && notify-send " wob loader" "$1" } @@ -32,10 +32,13 @@ render() main() { - exe="$1" && [ -z "$exe" ] && - usage && exit + exe="$1" + shift - if [ ! -p "$wobpipe" ]; then + if [ -z "$exe" ]; then + usage + exit + elif [ ! -p "$wobpipe" ]; then err "$wobpipe: named pipe does not exist" exit 1 elif ! command -v "$exe" > /dev/null; then @@ -43,7 +46,6 @@ main() exit 127 fi - shift case "$exe" in "wpctl") wpctl "$@" @@ -57,9 +59,6 @@ main() data="$(brightnessctl info | grep -o '[0-9]*%')" render "${data%\%}" ;; - "") - usage - ;; *) err "${exe}: not implemented" "$exe" "$@" |