summaryrefslogtreecommitdiff
path: root/tools/mail-zap
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-18 12:37:10 -0700
committerJohn Denker <jsd@av8n.com>2012-07-18 15:17:50 -0700
commitf5a71c7ffe157b46cace865ef36ee20bcf0de7a0 (patch)
tree2a09261d4b1b8219bf5055e96b80023397871cdd /tools/mail-zap
parentd200953a8fc800da589796c9bc87634f402b5e3c (diff)
add "-r" (reverse) mode to mail-zap
Diffstat (limited to 'tools/mail-zap')
-rwxr-xr-xtools/mail-zap23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/mail-zap b/tools/mail-zap
index 912d740..4467ef6 100755
--- a/tools/mail-zap
+++ b/tools/mail-zap
@@ -1,13 +1,26 @@
#! /bin/bash
-if test -z "$*" ; then
+todo=""
+verb="--spam"
+dest="spam"
+
+for arg in "$@" ; do
+ case "$arg" in
+ -r) verb="--forget"
+ dest="new"
+ ;;
+ *) todo="$todo $arg"
+ esac
+done
+
+if test -z "$todo" ; then
exit
fi
-mail-scan +subject "$@"
+mail-scan +subject $todo
-sa-learn --spam "$@"
+sa-learn $verb $todo
-for file in "$@" ; do
- mv "$file" "$(dirname $file)/../spam/"
+for file in $todo ; do
+ mv "$file" "$(dirname $file)/../$dest/"
done