cleanup of scripts

This commit is contained in:
2017-08-18 13:29:46 +02:00
parent 8e28c5626b
commit d416d0745e
2 changed files with 8 additions and 48 deletions

View File

@@ -6,7 +6,7 @@ source "$TMP"
# Move selectedly tagged mails to folders if they are only in INBOX # Move selectedly tagged mails to folders if they are only in INBOX
echo "[DEBUG] Move tagged mails in INBOX to folders" echo "[DEBUG] Move tagged mails in INBOX to folders (move-tag.sh)"
bash $CURDIR/scripts/move-tag.sh ${var_conn} bash $CURDIR/scripts/move-tag.sh ${var_conn}
# If offline mode, do a quick sync # If offline mode, do a quick sync
@@ -23,31 +23,19 @@ notmuch new
### Sort emails ### Sort emails
# Trash mod requests, Junk, Trash
echo "[DEBUG] Tag mails in ignore, spam, and trash folders"
notmuch tag +ignore -unread -- path:Lists.MOD.Trash/**
notmuch tag +spam -- path:INBOX.Junk/**
notmuch tag +del -unread -- path:Trash/**
# Moderation
echo "[DEBUG] Tag list moderation mails"
notmuch tag +mod -- path:Lists.MOD/**
# CVS
echo "[DEBUG] Tag cvs mails" # TODO is this necessary?
notmuch tag +cvs -- path:Lists.Web.CVS-Notify/**
# Sent
#notmuch tag +sent -unread -- path:Sent/**
# Archiv # Archiv
echo "[DEBUG] Tag mails in offline ARCHIVE folder" echo "[DEBUG] Tag mails in offline ARCHIVE folder"
notmuch tag +archive -- path:ARCHIVE/** notmuch tag +archive -- path:ARCHIVE/**
# Automatic tagging based on location of mails in folders # Automatic tagging based on location of mails in folders
echo "[DEBUG] Tag mails based on their folder" echo "[DEBUG] Tag mails based on their folder (tag-folder.sh)"
bash $CURDIR/scripts/tag-folder.sh # generates commands from tag-folder.csv bash $CURDIR/scripts/tag-folder.sh # generates commands from tag-folder.csv
bash $CURDIR/scripts/tag-folder-rules.sh # executes generated commands bash $CURDIR/scripts/tag-folder-rules.sh # executes generated commands
# Mark mails in certain folders read
echo "[DEBUG] Mark mails in trash folders read"
notmuch tag -unread -- path:Trash/**
notmuch tag -unread -- path:Trash.ignore-mod/**
echo "[DEBUG] poll.sh exited successfully" echo "[DEBUG] poll.sh exited successfully"

View File

@@ -1,28 +0,0 @@
#!/bin/bash
CURDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
CSV=$CURDIR/tag-list.csv
OUT=$CURDIR/tag-thread-rules.sh
> $OUT # reset
function notmuch_rule {
F_TAG=$1
F_FOL=$2
echo "notmuch tag +${F_TAG} -- thread:${F_FOL}/**"
}
while read line; do
TAG=$(echo $line | cut -d";" -f1)
FOL=$(echo $line | cut -d";" -f2)
NOTAG=$(echo $TAG | grep -o "," | wc -l)
NOTAG=$(expr $NOTAG + 1)
for ((i = 1; i <= $NOTAG; i++)); do
notmuch_rule $(echo $TAG | cut -d"," -f${i}) $FOL >> $OUT
done
done < "$CSV"