commit:     bd4eb9bd65045c50b475b8f475e780c182c5b857
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 21 21:51:41 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sat Feb 21 21:51:41 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=bd4eb9bd

readonly mode for processing new as well.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 ag | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ag b/ag
index 37c9079..b9f3f75 100755
--- a/ag
+++ b/ag
@@ -19,6 +19,7 @@ $options.name = nil
 $options.index_only = false
 $options.no_threading = false
 $options.debug = false
+$options.readonly = false
 
 op = OptionParser.new do |opts|
   opts.banner = "Usage: ag 
<<--index-full|--index-new|--delete|--reindex|--info> <--list listname>> 
<maildir/file/hash/messageid> [options]"
@@ -78,6 +79,10 @@ op = OptionParser.new do |opts|
   opts.on('--debug', 'Print debug messages') do
     $options.debug = true
   end
+
+  opts.on('--readonly', 'Do not alter the maildir in any way') do
+    $options.readonly = true
+  end
 end
 op.parse!
 
@@ -120,7 +125,7 @@ def do_incremental
 
     begin
       Ag::Storage.store($options.name, mail)
-      maildir_message.process
+      maildir_message.process unless $options.readonly
     rescue => e
       $stderr.puts "Cannot save message #{mail.message_id}: #{e.message}"
       next

Reply via email to