Reformatted excerpts from Marcus Williams's message of 2009-06-09:
> William - if you want to add this to sup/bin feel free. Its basically
> the regen_text method lifted and edited slightly from the
> label-list-mode

Nice idea. I'd add such a thing, but I think you can make it
significantly simpler. (As you point out, locking the index is not
necessary.)

Something like:

  #!/usr/bin/env ruby

  require 'sup'
  i = Redwood::Index.new; i.load
  l = Redwood::LabelManager.new File.join(ENV["HOME"], ".sup", "labels.txt")

  l.all_labels.
    map { |label| [label, l.string_for(label)] }.
    sort_by { |label, name| name }.
    each do |label, name|
      total = i.num_results_for :label => label
      unread = (label == :unread)? total : i.num_results_for(:labels => [label, 
:unread])
      printf "%20s: %6d messages, %6d unread\n", name, total, unread
    end

  puts "yay"
-- 
William <wmorgan-...@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to