changeset 552:742cf1eed463

common.subr: print the offending argument in error message of _ensure_no_options()
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 11 Sep 2024 12:02:41 +0200
parents b99bcd88b2a3
children 09c45b00333c
files share/local-bsdtools/common.subr
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/share/local-bsdtools/common.subr	Tue Sep 10 21:12:17 2024 +0200
+++ b/share/local-bsdtools/common.subr	Wed Sep 11 12:02:41 2024 +0200
@@ -153,8 +153,8 @@
 _ensure_no_options() {
     local _opt
 
-    while getopts ":" _opt ; do
-        [ "${_opt}" = '?' ] && { echo "ERROR: no option allowed" 1>&2; exit 2; }
+    while getopts ':' _opt ; do
+        [ "${_opt}" = '?' ] &&  fatal 2 "no option allowed (given: -${OPTARG-<unknown>})"
     done
     return 0
 }