summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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