From ce95717bd98e65a447aa2f0de6ae64e52bbfbe65 Mon Sep 17 00:00:00 2001 From: Nicholas Yip Date: Thu, 3 Dec 2020 02:39:09 +0900 Subject: [PATCH] feat(option): Support more conventional formats in the option parser --- wait-for | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/wait-for b/wait-for index 28b9b23..a8367c7 100755 --- a/wait-for +++ b/wait-for @@ -59,10 +59,25 @@ do QUIET=1 shift 1 ;; - -t) + -q-*) + QUIET=0 + echoerr "Unknown option: $1" + usage 1 + ;; + -q*) + QUIET=1 + result=$1 + shift 1 + set -- -"${result#-q}" "$@" + ;; + -t | --timeout) TIMEOUT="$2" shift 2 ;; + -t*) + TIMEOUT="${1#-t}" + shift 1 + ;; --timeout=*) TIMEOUT="${1#*=}" shift 1 @@ -74,7 +89,13 @@ do --help) usage 0 ;; + -*) + QUIET=0 + echoerr "Unknown option: $1" + usage 1 + ;; *) + QUIET=0 echoerr "Unknown argument: $1" usage 1 ;;