push-to-pull-request: Accept intermixed options and arguments again.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-02-01 11:46:12 -08:00 committed by Greg Price
parent 652fea9bdf
commit 70f491eae2
1 changed files with 29 additions and 23 deletions

View File

@ -27,32 +27,38 @@ EOF
} }
merge= merge=
args=()
while getopts ":-:" opt; do while ((OPTIND <= $#)); do
case $opt in if getopts ":-:" opt; then
-) case $opt in
case "$OPTARG" in -)
help) case "$OPTARG" in
usage help)
exit 0 usage
;; exit 0
merge) ;;
merge=t merge)
;; merge=t
*) ;;
echo "Invalid option: --$OPTARG" >&2 *)
exit 1 echo "Invalid option: --$OPTARG" >&2
;; exit 1
esac ;;
;; esac
\?) ;;
echo "Invalid option: -$OPTARG" >&2 \?)
exit 1 echo "Invalid option: -$OPTARG" >&2
;; exit 1
esac ;;
esac
else
args+=("${!OPTIND}")
((OPTIND++))
fi
done done
shift $((OPTIND - 1)) set -- "${args[@]}"
remote_default="$(git config zulip.zulipRemote || echo upstream)" remote_default="$(git config zulip.zulipRemote || echo upstream)"
pseudo_remote="$(git config zulip.prPseudoRemote || echo)" pseudo_remote="$(git config zulip.prPseudoRemote || echo)"