commit:     193f7811ee0156c8b0d52b0c21bfaef528d8f173
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 24 04:20:45 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Feb 24 04:20:45 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=193f7811

Make a rethread command.

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

---
 ag | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/ag b/ag
index 00ce189..8b08cc2 100755
--- a/ag
+++ b/ag
@@ -30,7 +30,7 @@ $options.need_argument = true
 $options.argmode = nil
 
 op = OptionParser.new do |opts|
-  opts.banner = "Usage: ag 
<<--index-full|--index-new|--delete-msg|--delete-index|--reindex|--info> 
<--list listname>> <[--file|--msgid|--hash] <maildir/file/hash/messageid>> 
[options]"
+  opts.banner = "Usage: ag 
<<--index-full|--index-new|--delete-msg|--delete-index|--reindex|--rethread|--info>
 <--list listname>> <[--file|--msgid|--hash] <maildir/file/hash/messageid>> 
[options]"
 
   opts.on('--index-full', 'Read the full past archive from Maildir/cur. Needs 
--list and a Maildir') do
     abort 'Can only select one action' if $options.action != nil
@@ -58,6 +58,13 @@ op = OptionParser.new do |opts|
     $options.action = :do_create_index
     $options.need_argument = false
   end
+  
+  opts.on('--rethread', 'Rethread messages. Needs --list') do
+    abort 'Can only select one action' if $options.action != nil
+
+    $options.action = :do_rethread
+    $options.need_argument = false
+  end
 
   opts.on('--delete-index', 'Delete index. Needs --list') do
     abort 'Can only select one action' if $options.action != nil
@@ -171,7 +178,7 @@ def do_full
     end
   end
 
-  Ag::Threading.calc($options.name) unless $options.no_threading
+  do_rethread
 end
 
 def do_incremental
@@ -194,6 +201,10 @@ def do_incremental
     end
   end
 
+  do_rethread
+end
+
+def do_rethread
   Ag::Threading.calc($options.name) unless $options.no_threading
 end
 

Reply via email to