Nicolas Pouillard
2008-Nov-14 12:29 UTC
[sup-talk] [PATCH] Add a --query option to sup-tweak-labels.
---
bin/sup-tweak-labels | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
index 21e766c..4d1313e 100644
--- 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
--
1.5.5.rc3
William Morgan
2008-Nov-20 15:15 UTC
[sup-talk] [PATCH] Add a --query option to sup-tweak-labels.
Applied, thanks. Sorry for the slow patch turnaround time recently. I''m moving across the country and only have bits of time here and there, at least for another week or so. -- William <wmorgan-sup at masanjin.net>