better option formatting and handling for specifying repositories.

This commit is contained in:
Adam Sanderson 2010-11-08 21:12:21 -08:00
parent ac5e9c233a
commit c3edb028ec
1 changed files with 7 additions and 3 deletions

8
bin/qw
View File

@ -11,10 +11,14 @@ opts = OptionParser.new do |opts|
opts.banner = "Usage: qwandry [options] name" opts.banner = "Usage: qwandry [options] name"
opts.separator "" opts.separator ""
opts.on("-r", "--repo LABEL", "Only search in repository LABEL") do |label| opts.on("-r", "--repo LABEL", "Only search in repository LABEL","Repositories:", *@qwandry.repositories.keys.map{|k| "* #{k}"}) do |label|
if @qwandry.repositories.has_key? label
@repository_label = label @repository_label = label
else
STDERR.puts "Repository '#{label}' in not available, searching all repositories"
end end
opts.separator "Known Repositories: #{@qwandry.repositories.keys.join(", ")}" end
opts.on("-e", "--editor EDITOR", "Use EDITOR to open the package") do |editor| opts.on("-e", "--editor EDITOR", "Use EDITOR to open the package") do |editor|
@qwandry.editor = editor @qwandry.editor = editor
end end