From a03c66ea31c19118fe2aa89b41fa6aca14e605b6 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 1 Jun 2023 10:29:49 +0530 Subject: wobload: spring cleaning: redundant lines, errmsg to stderr, ... --- .local/bin/wobload | 15 +++++++-------- 1 file 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" "$@" -- cgit v1.2.3