~ubuntu-branches/ubuntu/karmic/sup-mail/karmic

« back to all changes in this revision

Viewing changes to bin/sup-tweak-labels

  • Committer: Bazaar Package Importer
  • Author(s): Decklin Foster
  • Date: 2009-03-28 15:27:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090328152750-hsvh7smby6s1c7j6
Tags: 0.7-1
* New upstream version
  - Index locking fixed (Closes: #520070)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
EOS
39
39
  opt :add, "One or more labels (comma-separated) to add to every message from the specified sources", :type => String
40
40
  opt :remove, "One or more labels (comma-separated) to remove from every message from the specified sources, if those labels are present", :type => String
 
41
  opt :query, "A Sup search query", :type => String
41
42
 
42
43
  text <<EOS
43
44
 
75
76
    ## query to only messages with those labels
76
77
    query += " +(" + remove_labels.map { |l| "label:#{l}" }.join(" ") + ")"
77
78
  end
 
79
  query += ' ' + opts[:query] if opts[:query]
 
80
 
 
81
  qobj, opts = Redwood::Index.parse_user_query_string query
 
82
  query = Redwood::Index.build_query opts.merge(:qobj => qobj)
78
83
 
79
84
  results = index.ferret.search query, :limit => :all
80
85
  num_total = results.total_hits