All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
3 # edit-header - helper script to append/replace/remove headers with mutt
5 # Based on an idea by David Champion <dgc at uchicago.edu>
7 # Copyright © 2008 martin f. krafft <madduck@madduck.net>
8 # Released under the terms of the Artistic Licence 2.0
12 if [ ! -x "$(command -v formail)" ]; then
13 echo E: formail not installed. >&2
18 if [ -z "$header" ]; then
19 echo "E: no header specified" >&2
26 printf "Enter ${1:-header} contents: " >/dev/tty
27 read contents </dev/tty
31 script="${0%/*}/${2:-}"
32 if [ -f "$script" ] && [ -x "$script" ]; then
33 contents_source="$script"
36 contents_source=get_header_contents
41 *append-header|*supersede-header|*replace-header)
43 [ -n "$contents" ] || contents="$(eval $contents_source $header)"
45 *append-header) flag=-A;;
46 *supersede-header) flag=-i;;
47 *replace-header) flag=-I;;
49 editor="${0%/*}/filter-proxy formail $flag \'$header: $contents\'"
53 editor="${0%/*}/filter-proxy formail -I \'$header:\'"
57 echo "E: unknown invocation: ${0##*/}" >&2
63 echo "set my_editor=\"\$editor\'"
64 echo "set editor=\"$editor\""
65 echo "push <tag-prefix><edit>"
66 # we need to push this so it happens after the editing
67 echo "push :set editor=\"\$my_editor\"<enter>"