commit fdc18355df109b63f7e814a1f66a1bf74b46f7da parent 3309cfeb79dc78b3a51498f673023d2b6a0e210e Author: Xinglu Chen <public@yoctocell.xyz> Date: Tue, 9 Feb 2021 11:55:15 +0100 notmuch-am: Add brief usage instructions Most people who haven't followed the messages in the nixpkgs-dev mailing lists probably won't know how this was intended to be used. Signed-off-by: William Casarin <jb55@jb55.com> Signed-off-by: Xinglu Chen <public@yoctocell.xyz> Diffstat:
M | notmuch-am | | | 33 | ++++++++++++++++++++++++++++----- |
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/notmuch-am b/notmuch-am @@ -1,7 +1,30 @@ #!/usr/bin/env bash -mbox=$(mktemp) -notmuch show --format=mbox "$1" > "$mbox" -msgid=$(grep -i ^message-id "$mbox" | cut -d" " -f2 | head -n1) -b4 am "$msgid" -m "$mbox" -rm -f "$mbox" +usage () { + printf %s "\ +Usage: notmuch-am <thread-id> + +Use b4 to apply a patchset from a thread. + +Example + + $ notmuch-am thread:000000000001b70e + Analyzing 6 messages in the thread + --- + Writing ./20210206_jb55_b4_init_at_0_6_2.mbx + [PATCH] b4: init at 0.6.2 + + Reviewed-by: Xinglu Chen <public@yoctocell.xyz> (✓ DKIM/yoctocell.xyz) + + Reviewed-by: Matthias Beyer <mail@beyermatthias.de> +" +exit 0 +} + +main () { + mbox=$(mktemp) + notmuch show --format=mbox "$1" > "$mbox" + msgid=$(grep -i ^message-id "$mbox" | cut -d" " -f2 | head -n1) + b4 am "$msgid" -m "$mbox" + rm -f "$mbox" +} + +[ -n "$1" ] || usage && main "$@"