Skip to content

Commit

Permalink
Merge pull request #28 from Liupold/ordered-flag-pre-check
Browse files Browse the repository at this point in the history
Fixes #26
  • Loading branch information
SeerLite committed Aug 2, 2020
2 parents 660effe + 8c3c821 commit 4f6dcda
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions pidswallow
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,34 @@ loop() {

TEMP=$(getopt -o 'Vghlt:s:v:' --long 'verbose,glue,help,loop,toggle:,swallow:,vomit:' \
-n 'pidswallow' -- "$@")
eval set -- "${TEMP}"; unset TEMP

# precheck
eval set -- "${TEMP}"
while true; do
case "$1" in
'-h' | '--help' )
echo "$usage" && exit 0;;
'-V'|'--verbose')
verbose=1
[ "$verbose" -eq 1 ] && echo "SWALLOWABLE: \"$swallowable\""
shift; continue;;
'-g'|'--glue')
glue=1
shift; continue;;
'--')
shift; break;;
*)
shift; continue;;
esac
done

eval set -- "${TEMP}"; unset TEMP
while true; do
case "$1" in
'-V'|'--verbose')
shift; continue;;
'-g'|'--glue')
shift; continue;;
'-h' | '--help' )
echo "$usage" && exit 0;;
'-t'|'--toggle')
toggle "$2" || exit "$?"
shift 2; continue;;
Expand Down

0 comments on commit 4f6dcda

Please sign in to comment.