[mail] fix: filters for univ
This commit is contained in:
parent
438c25f4ff
commit
e28c09a733
@ -1,3 +1,23 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
notmuch tag --input $XDG_CONFIG_HOME/notmuch/tags/univ
|
||||
# The accounts to be cleaned
|
||||
accounts="univ"
|
||||
|
||||
filter() {
|
||||
notmuch search --output=files --format=text0 $parameters and tag:unread| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/new/"
|
||||
notmuch search --output=files --format=text0 $parameters and not tag:unread| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/cur/"
|
||||
}
|
||||
|
||||
for account in $accounts
|
||||
do
|
||||
notmuch tag --input $XDG_CONFIG_HOME/notmuch/tags/$account
|
||||
tags_location="$XDG_CONFIG_HOME/notmuch/tags/$account"
|
||||
tags="$(grep "+" "$tags_location" | sed -e 's/^.//' -e 's/ .*//')"
|
||||
for tag in $tags
|
||||
do
|
||||
case $tag in
|
||||
"+univ") ;;
|
||||
*) parameters="folder:$account/INBOX and tag:$tag" && filter;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
|
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Archive files that are NOT tagged Inbox
|
||||
accounts="univ"
|
||||
|
||||
# Update paths & tags
|
||||
notmuch new --no-hooks
|
||||
|
||||
filter() {
|
||||
notmuch search --output=files --format=text0 $parameters and tag:new| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/new/"
|
||||
notmuch search --output=files --format=text0 $parameters and not tag:new| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/cur/"
|
||||
}
|
||||
|
||||
for account in $accounts
|
||||
do
|
||||
tags_location="$XDG_CONFIG_HOME/notmuch/tags/$account"
|
||||
tags="$(grep "+" "$tags_location" | sed -e 's/^.//' -e 's/ .*//')"
|
||||
for tag in $tags
|
||||
do
|
||||
[ "univ" = $tag ] && continue
|
||||
parameters="folder:$account/INBOX and tag:$tag"
|
||||
filter
|
||||
done
|
||||
done
|
||||
|
||||
# Update paths
|
||||
notmuch new --no-hooks
|
Reference in New Issue
Block a user