sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 6ae6412ddcb678f79c1fb419903445604fd9609b
parent 8925a432832445cbf75c298aef1607b0feebe5b5
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sun,  3 Jan 2010 08:32:05 -0500

add an --index option to everything in bin/

Diffstat:
M bin/sup | 4 ++--
M bin/sup-add | 3 ++-
M bin/sup-dump | 5 +++--
M bin/sup-sync | 3 ++-
M bin/sup-sync-back | 3 ++-
M bin/sup-tweak-labels | 3 ++-
6 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -48,6 +48,7 @@ EOS
   opt :search, "Search for this query upon startup", :type => String
   opt :compose, "Compose message to this recipient upon startup", :type => String
   opt :subject, "When composing, use this subject", :type => String, :short => "j"
+  opt :index, "Use this index type ('auto' for autodetect)", :default => "auto"
 end
 
 Trollop::die :subject, "requires --compose" if $opts[:subject] && !$opts[:compose]
@@ -147,10 +148,9 @@ def stop_cursing
 end
 module_function :start_cursing, :stop_cursing
 
-Index.init
+Index.init $opts[:index]
 Index.lock_interactively or exit
 
-
 if Index.is_a_deprecated_ferret_index?
   FERRET_DEPRECATION_WARNING_FN = File.join BASE_DIR, "you-have-been-warned-about-ferret-deprecation"
   unless File.exist? FERRET_DEPRECATION_WARNING_FN
diff --git a/bin/sup-add b/bin/sup-add
@@ -40,6 +40,7 @@ EOS
   opt :labels, "A comma-separated set of labels to apply to all messages from this source", :type => String
   opt :force_new, "Create a new account for this source, even if one already exists."
   opt :force_account, "Reuse previously defined account user@hostname.", :type => String
+  opt :index, "Use this index type ('auto' for autodetect)", :default => "auto"
 end
 
 Trollop::die "require one or more sources" if ARGV.empty?
@@ -85,7 +86,7 @@ end
 
 $terminal.wrap_at = :auto
 Redwood::start
-index = Redwood::Index.init
+index = Redwood::Index.init $opts[:index]
 
 index.lock_interactively or exit
 
diff --git a/bin/sup-dump b/bin/sup-dump
@@ -17,11 +17,12 @@ Usage:
   sup-dump > <filename>
   sup-dump | bzip2 > <filename> # even better
 
-No options.
+Options:
 EOS
+  opt :index, "Use this index type ('auto' for autodetect)", :default => "auto"
 end
 
-index = Redwood::Index.init
+index = Redwood::Index.init $opts[:index]
 Redwood::SourceManager.init
 index.load
 
diff --git a/bin/sup-sync b/bin/sup-sync
@@ -76,6 +76,7 @@ text <<EOS
 
 Other options:
 EOS
+  opt :index, "Use this index type ('auto' for autodetect)", :default => "auto"
   opt :verbose, "Print message ids as they're processed."
   opt :optimize, "As the final operation, optimize the index."
   opt :all_sources, "Scan over all sources.", :short => :none
@@ -95,7 +96,7 @@ target = [:new, :changed, :all, :restored].find { |x| opts[x] } || :new
 op = [:asis, :restore, :discard].find { |x| opts[x] } || :asis
 
 Redwood::start
-index = Redwood::Index.init
+index = Redwood::Index.init opts[:index]
 
 restored_state = if opts[:restore]
   dump = {}
diff --git a/bin/sup-sync-back b/bin/sup-sync-back
@@ -47,6 +47,7 @@ EOS
   opt :with_dotlockfile, "Specific dotlockfile location (mbox files only).", :default => "/usr/bin/dotlockfile", :short => :none
   opt :dont_use_dotlockfile, "Don't use dotlockfile to lock mbox files. Dangerous if other processes modify them concurrently.", :default => false, :short => :none
 
+  opt :index, "Use this index type ('auto' for autodetect)", :default => "auto"
   opt :verbose, "Print message ids as they're processed."
   opt :dry_run, "Don't actually modify the index. Probably only useful with --verbose.", :short => "-n"
   opt :version, "Show version information", :short => :none
@@ -65,7 +66,7 @@ EOS
 end
 
 Redwood::start
-index = Redwood::Index.init
+index = Redwood::Index.init $opts[:index]
 index.lock_interactively or exit
 
 deleted_fp, spam_fp = nil
diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
@@ -46,6 +46,7 @@ EOS
 
 Other options:
 EOS
+  opt :index, "Use this index type ('auto' for autodetect)", :default => "auto"
   opt :verbose, "Print message ids as they're processed."
   opt :very_verbose, "Print message names and subjects as they're processed."
   opt :all_sources, "Scan over all sources.", :short => :none
@@ -60,7 +61,7 @@ remove_labels = opts[:remove].to_set_of_symbols ","
 Trollop::die "nothing to do: no labels to add or remove" if add_labels.empty? && remove_labels.empty?
 
 Redwood::start
-index = Redwood::Index.init
+index = Redwood::Index.init $opts[:index]
 index.lock_interactively or exit
 begin
   index.load