lib/imw/runner.rb in imw-0.1.1 vs lib/imw/runner.rb in imw-0.2.0
- old
+ new
@@ -16,11 +16,11 @@
attr_reader :args, :options
def initialize *args
@args = args
@options = DEFAULT_OPTIONS.dup
- parser.parse!(args) # will trim options from args
+ parser.parse!(args)
end
def parser
OptionParser.new do |opts|
opts.banner = "usage: imw [OPTIONS] TASK"
@@ -65,25 +65,26 @@
def task
args.first
end
def handles
+ require 'set'
matched_handles = Set.new
if options[:selectors].blank?
- matched_handles += IMW::REPOSITORY.keys
+ matched_handles += IMW.repository.keys
else
- keys = IMW::REPOSITORY.keys
+ keys = IMW.repository.keys
unless keys.empty?
options[:selectors].each do |selector|
matched_handles += keys.find_all { |key| key =~ Regexp.new(selector) }
end
end
end
matched_handles.to_a.sort
end
def datasets
- handles.map { |handle| IMW::REPOSITORY[handle] }
+ handles.map { |handle| IMW.repository[handle] }
end
def list!
puts handles
exit