From 2787a16a9fb6e573d44ccdd6043ef1a5571a8377 Mon Sep 17 00:00:00 2001 From: Adam Sanderson Date: Mon, 16 Aug 2010 21:06:58 -0700 Subject: [PATCH] gracefully handle 0 matches. --- qwandry.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qwandry.rb b/qwandry.rb index a14b7b5..038f654 100755 --- a/qwandry.rb +++ b/qwandry.rb @@ -101,7 +101,11 @@ if __FILE__ == $0 end package = nil - if packages.length == 1 + case packages.length + when 0 + puts "No packages matched '#{name}'" + exit 1 + when 1 package = packages.first else packages.each_with_index do |package, index|