Skip to content

Commit

Permalink
feat(option): Support more conventional formats in the option parser
Browse files Browse the repository at this point in the history
  • Loading branch information
sd-yip authored and Addono committed Feb 2, 2021
1 parent 2ed5308 commit ce95717
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion wait-for
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -74,7 +89,13 @@ do
--help)
usage 0
;;
-*)
QUIET=0
echoerr "Unknown option: $1"
usage 1
;;
*)
QUIET=0
echoerr "Unknown argument: $1"
usage 1
;;
Expand Down

0 comments on commit ce95717

Please sign in to comment.