sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 308953d67001f7d2b834c28d41d00c28f28086d3
parent 94b05b8147e4373b6c939aad0f0f2f1c1599baa4
Author: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Date:   Fri, 14 Nov 2008 13:29:25 +0100

Add a --query option to sup-tweak-labels.

Diffstat:
M bin/sup-tweak-labels | 5 +++++
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
@@ -39,6 +39,7 @@ Options:
 EOS
   opt :add, "One or more labels (comma-separated) to add to every message from the specified sources", :type => String
   opt :remove, "One or more labels (comma-separated) to remove from every message from the specified sources, if those labels are present", :type => String
+  opt :query, "A Sup search query", :type => String
 
   text <<EOS
 
@@ -76,6 +77,10 @@ begin
     ## query to only messages with those labels
     query += " +(" + remove_labels.map { |l| "label:#{l}" }.join(" ") + ")"
   end
+  query += ' ' + opts[:query] if opts[:query]
+
+  qobj, opts = Redwood::Index.parse_user_query_string query
+  query = Redwood::Index.build_query opts.merge(:qobj => qobj)
 
   results = index.ferret.search query, :limit => :all
   num_total = results.total_hits