Skip to content

Commit 526918b

Browse files
committed
feat(option): Support more conventional formats in the option parser
1 parent 23bbf6d commit 526918b

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

wait-for

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,25 @@ do
5959
QUIET=1
6060
shift 1
6161
;;
62-
-t)
62+
-q-*)
63+
QUIET=0
64+
echoerr "Unknown option: $1"
65+
usage 1
66+
;;
67+
-q*)
68+
QUIET=1
69+
result=$1
70+
shift 1
71+
set -- -"${result#-q}" "$@"
72+
;;
73+
-t | --timeout)
6374
TIMEOUT="$2"
6475
shift 2
6576
;;
77+
-t*)
78+
TIMEOUT="${1#-t}"
79+
shift 1
80+
;;
6681
--timeout=*)
6782
TIMEOUT="${1#*=}"
6883
shift 1
@@ -74,7 +89,13 @@ do
7489
--help)
7590
usage 0
7691
;;
92+
-*)
93+
QUIET=0
94+
echoerr "Unknown option: $1"
95+
usage 1
96+
;;
7797
*)
98+
QUIET=0
7899
echoerr "Unknown argument: $1"
79100
usage 1
80101
;;

0 commit comments

Comments
 (0)