This repository has been archived on 2023-01-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mail-config/astroid/scripts/tag-folder.sh

29 lines
601 B
Bash
Executable File

#!/bin/bash
CURDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
CSV=$CURDIR/tag-list.csv
OUT=$CURDIR/tag-folder-rules.sh
> $OUT # reset
function notmuch_rule {
F_TAG=$1
F_FOL=$2
echo "notmuch tag +${F_TAG} -- path:${F_FOL}/**"
}
while read line; do
if $(echo "$line" | grep -qE "^\s*#|^\s*$"); then continue; fi
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"