X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=tg-mail.sh;h=24e5f67b2742b8edf6fd6213f58d6546a27e013c;hb=97ce88672c1c2bd6decabc54f5ae1e08e4ea8f32;hp=cf68155565f8ab90945704489f92850a639e8831;hpb=5fe44ffca84c42baa8c56687dd2a68f2799966f2;p=topgit.git diff --git a/tg-mail.sh b/tg-mail.sh index cf68155..24e5f67 100644 --- a/tg-mail.sh +++ b/tg-mail.sh @@ -3,6 +3,7 @@ # GPLv2 name= +send_email_args= ## Parse options @@ -10,8 +11,10 @@ name= while [ -n "$1" ]; do arg="$1"; shift case "$arg" in + -s) + send_email_args="$1"; shift;; -*) - echo "Usage: tg [...] mail [NAME]" >&2 + echo "Usage: tg [...] mail [-s SEND_EMAIL_ARGS] [NAME]" >&2 exit 1;; *) [ -z "$name" ] || die "name already specified ($name)" @@ -37,16 +40,14 @@ from="$(echo "$header" | grep '^From:' | sed 's/From:\s*//')" to="$(echo "$header" | grep '^To:' | sed 's/To:\s*//')" -# XXX I can't get quoting right without arrays -[ -n "$from" ] && from=(--from "$from") -[ -n "$to" ] && to=(--to "$to") # FIXME there could be multimple To - +# XXX: I can't get quoting right without arrays people=() -[ -n "$from" ] && people=("${people[@]}" "${from[@]}") -[ -n "$to" ] && people=("${people[@]}" "${to[@]}") +[ -n "$from" ] && people=("${people[@]}" --from "$from") +# FIXME: there could be multimple To +[ -n "$to" ] && people=("${people[@]}" --to "$to") -# NOTE git-send-email handles cc itself -git send-email "${people[@]}" "$patchfile" +# NOTE: git-send-email handles cc itself +git send-email $send_email_args "${people[@]}" "$patchfile" rm "$patchfile"