diff options
author | June McEnroe <june@causal.agency> | 2020-05-02 21:30:15 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-05-02 21:30:15 -0400 |
commit | 92ae4fc94e81d694ca1cb3637efd42101b2763e3 (patch) | |
tree | 8db6699ec735e020ac2c535271135e85b23321c1 | |
parent | Remove git am from imbox.1 example (diff) | |
download | imbox-92ae4fc94e81d694ca1cb3637efd42101b2763e3.tar.gz imbox-92ae4fc94e81d694ca1cb3637efd42101b2763e3.zip |
Fix git-fetch-email argument parsing
Shell script is hard.
-rw-r--r-- | git-fetch-email.sh | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/git-fetch-email.sh b/git-fetch-email.sh index 8fcb66d..83243c7 100644 --- a/git-fetch-email.sh +++ b/git-fetch-email.sh @@ -42,17 +42,19 @@ v,verbose log IMAP protocol to standard error " eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)" -for opt; do +while [ $# -gt 0 ]; do + opt=$1 + shift case "${opt}" in - (-C) cc=$2; shift;; - (-F) from=$2; shift;; - (-S) subject=$2; shift;; - (-T) to=$2; shift;; + (-C) cc=$1; shift;; + (-F) from=$1; shift;; + (-S) subject=$1; shift;; + (-T) to=$1; shift;; (-a) apply=1;; - (-h) host=$2; shift;; - (-m) mailbox=$2; shift;; - (-p) port=$2; shift;; - (-u) user=$2; shift;; + (-h) host=$1; shift;; + (-m) mailbox=$1; shift;; + (-p) port=$1; shift;; + (-u) user=$1; shift;; (-v) verbose=1;; (--no-apply) apply=;; (--no-cc) cc=;; @@ -62,7 +64,6 @@ for opt; do (--no-verbose) verbose=;; (--) break;; esac - shift done if [ -z "${user:-}" ]; then echo "${0}: username required" >&2 |