From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 9 May 2025 09:01:56 +0000 (+0000)
Subject: Fix.
X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bdb.prefix%7D%7D/static/new_day?a=commitdiff_plain;p=config

Fix.
---

diff --git a/testing/copy/desktop/home/plom/.local/bin/vol b/testing/copy/desktop/home/plom/.local/bin/vol
index 837988b..3481e01 100755
--- a/testing/copy/desktop/home/plom/.local/bin/vol
+++ b/testing/copy/desktop/home/plom/.local/bin/vol
@@ -33,8 +33,11 @@ USAGE_DESC_LOUDNESS="volume to set (as percentage, should be integer <= ${MAX_LO
 
 
 
-error_exit() {
-    abort "Aborting due to $1\n\n$(print_usage)"
+abort_bad_args() {
+    echo "Aborting due to unrecognized argument(s): $@" >&2
+    echo ""
+    print_usage
+    exit 1
 }
 
 set_target_device() {
@@ -58,7 +61,7 @@ toggle_mute() {
 set_volume_as_percentage() {
     _PERCENTAGE=$(echo "$1" | tr -d '%')
     if [ "${_PERCENTAGE}" -gt "${MAX_LOUDNESS}" ]; then
-        error_exit "demand for unreasonably high loudness: ${_PERCENTAGE}%."
+        abort "Aborting due to demand for unreasonably high loudness: ${_PERCENTAGE}%."
     fi
     AT_FULL=65536
     pacmd set-${TARGET_TYPE}-volume "${TARGET_IDX}" $(calc "(${_PERCENTAGE} * ${AT_FULL} // 100)")
@@ -78,6 +81,7 @@ if [ "$(echo $1 | cut -c1)" = '-' ]; then
         set_target_device 'microphone' 1 'source'
     else
         error_exit "unrecognized argument: $1"
+        abort_bad_args $@
     fi
     shift 1
 fi
@@ -86,5 +90,5 @@ if [ -z "$1" ]; then
 elif [ -z "$(echo -n $1 | sed -E 's/[0-9]*[%]?//g')" ]; then
     set_volume_as_percentage "$1"
 else
-    error_exit "unrecognized argument: $1"
+    abort_bad_args $@
 fi