bin/sup-tweak-labels in sup-0.22.1 vs bin/sup-tweak-labels in sup-0.23

- old
+ new

@@ -1,10 +1,10 @@ #!/usr/bin/env ruby $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) -require 'trollop' +require 'optimist' require "sup" class Float def to_s; sprintf '%.2f', self; end def to_time_s @@ -23,11 +23,11 @@ startt = Time.now yield Time.now - startt end -opts = Trollop::options do +opts = Optimist::options do version "sup-tweak-labels (sup #{Redwood::VERSION})" banner <<EOS Batch modification of message state for messages already in the index. Usage: @@ -56,11 +56,11 @@ opts[:verbose] = true if opts[:very_verbose] add_labels = opts[:add].to_set_of_symbols "," 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? +Optimist::die "nothing to do: no labels to add or remove" if add_labels.empty? && remove_labels.empty? Redwood::start index = Redwood::Index.init index.lock_interactively or exit @@ -69,13 +69,13 @@ source_ids = if opts[:all_sources] Redwood::SourceManager.sources else ARGV.map do |uri| - Redwood::SourceManager.source_for uri or Trollop::die "Unknown source: #{uri}. Did you add it with sup-add first?" + Redwood::SourceManager.source_for uri or Optimist::die "Unknown source: #{uri}. Did you add it with sup-add first?" end end.map { |s| s.id } - Trollop::die "nothing to do: no sources" if source_ids.empty? + Optimist::die "nothing to do: no sources" if source_ids.empty? query = "(" + source_ids.map { |id| "source_id:#{id}" }.join(" OR ") + ")" if add_labels.empty? ## if all we're doing is removing labels, we can further restrict the ## query to only messages with those labels