34 lines
944 B
Bash
34 lines
944 B
Bash
# Wrapper around notmuch
|
|
|
|
# Print the message id of the last message within a thread.
|
|
# @argument $1: thread id
|
|
nm_last_message_in_thread() {
|
|
$NOTMUCH search --output=messages --offset=-1 thread:"$1" | sed 's/^...//'
|
|
}
|
|
|
|
# Print the header of a message (with trailing empty line)
|
|
# @argument $1: message id
|
|
nm_message_header() {
|
|
$NOTMUCH show --body=false id:"$1" | awk "$AWK_MESSAGEHEADER"
|
|
}
|
|
|
|
# Print the message parts (with indents)
|
|
# @argument $1: message id
|
|
nm_message_parts() {
|
|
$NOTMUCH show --body=true id:"$1" | awk "$AWK_MESSAGEPARTS"
|
|
}
|
|
|
|
# Print the message part number for text/plain or text/html
|
|
# @argument $1: message id
|
|
# @argument $2: if set, then the html part number will be printed
|
|
nm_message_part_nr() {
|
|
$NOTMUCH show --body=true id:"$1" | awk -v html="${2:-}" "$AWK_PARTNR"
|
|
}
|
|
|
|
# Print part of message
|
|
# @argument $1: message id
|
|
# @argument $2: part number
|
|
nm_message_get_part() {
|
|
$NOTMUCH show --part="$2" id:"$1"
|
|
}
|