From c3edb028ec814acbcd2f906c666262be973ef14b Mon Sep 17 00:00:00 2001 From: Adam Sanderson Date: Mon, 8 Nov 2010 21:12:21 -0800 Subject: [PATCH] better option formatting and handling for specifying repositories. --- bin/qw | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/qw b/bin/qw index 7b29498..e893a58 100755 --- a/bin/qw +++ b/bin/qw @@ -11,10 +11,14 @@ opts = OptionParser.new do |opts| opts.banner = "Usage: qwandry [options] name" opts.separator "" - opts.on("-r", "--repo LABEL", "Only search in repository LABEL") do |label| - @repository_label = 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 + else + STDERR.puts "Repository '#{label}' in not available, searching all repositories" + end end - opts.separator "Known Repositories: #{@qwandry.repositories.keys.join(", ")}" + opts.on("-e", "--editor EDITOR", "Use EDITOR to open the package") do |editor| @qwandry.editor = editor end