commit d4cfba937661ca5856ba5b14ca66c02e531638c5
parent 9643bc8204ac1406462a4fe56d56616bccae7874
Author: William Casarin <jb55@jb55.com>
Date: Mon, 8 Feb 2021 09:25:39 -0800
notmuch-am, b4 scripts
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
5 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/bin/fuzz-notmuch-am b/bin/fuzz-notmuch-am
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+set -eou pipefail
+
+thread_search=$(fuzz-notmuch-query-thread "$@")
+thread=$(eval "$thread_search")
+fuzz-record-command "thread=\$($thread_search) && notmuch-thread-reader \$thread"
+echo "notmuch am $thread"
diff --git a/bin/fuzz-notmuch-query b/bin/fuzz-notmuch-query
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -eou pipefail
-FUZZ_QUERY=${FUZZ_QUERY:-""}
-query=$(notmuch queries | fuzzer "^query:$FUZZ_QUERY")
+query=${FUZZ_QUERY:-$(notmuch queries | fuzzer ^query:)}
echo notmuch search "$@" "$query"
diff --git a/bin/fuzz-notmuch-threads b/bin/fuzz-notmuch-threads
@@ -3,7 +3,6 @@
set -eou pipefail
thread_search=$(fuzz-notmuch-query-thread "$@")
-
thread=$(eval "$thread_search")
fuzz-record-command "thread=\$($thread_search) && notmuch-thread-reader \$thread"
echo "notmuch-thread-reader $thread"
diff --git a/bin/notmuch-am b/bin/notmuch-am
@@ -0,0 +1,7 @@
+#!/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"
diff --git a/dotfiles/commands b/dotfiles/commands
@@ -27,6 +27,7 @@ gb git branches echo git bvr
ni notmuch inbox fuzz-notmuch-inbox
nt notmuch threads fuzz-notmuch-threads
nat notmuch archive fuzz-notmuch-archive
+nam notmuch am fuzz-notmuch-am
nai notmuch archive inbox fuzz-notmuch-archive-inbox
nq notmuch query fuzz-notmuch-query
es email status echo email-status-once