dotfiles/conf.d/astroid/hooks/trash
2021-03-01 22:41:37 +01:00

36 lines
825 B
Bash
Executable File

#!/bin/bash
# File : trash
# Author : Jeff LANCE <email@jefflance.me>
# Date : 10.02.2015
# Last Modified Date: 06.05.2020
# Last Modified By : Jeff LANCE <email@jefflance.me>
#
# $1 = message id
echo "[Begin astroid] $(basename $0) script"
# All directory names relative to mail folder's root
DIR_INBOX="inbox" # Inbox directory path
DIR_TRASH="trash" # Trash directory path
# Get thread ID and message ID
TID=$1
MID=$2
FILE=$(notmuch search --exclude=false --output=files\
"thread:${TID}" "${MID:+id:$MID}")
# Trash mail and unset inbox
# notmuch tag --remove-all -- "thread:${TID}" "${MID:+id:$MID}"
notmuch tag -inbox +deleted -- "thread:${TID}" "${MID:+id:$MID}"
# Move mail with afew
afew --move-mails
echo "[End astroid] $(basename $0) script"
exit 0
# vim:ft=sh