aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorMax Howell2009-10-26 18:16:42 +0000
committerMax Howell2009-11-07 18:22:33 +0000
commit8081a95c4acc2e83de22453b663959af9fc85ac5 (patch)
tree6fdb789b2330cd17d147aae8d50efc3349b47ac9 /Library/Homebrew/extend
parent03ca3e24d0ccd4633a29aab6b1dc1c43ead5c4e2 (diff)
downloadbrew-8081a95c4acc2e83de22453b663959af9fc85ac5.tar.bz2
Better errors if missing keg or formula arguments
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ARGV.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index e7585edbc..50ad56334 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -21,6 +21,10 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+class UsageError <RuntimeError; end
+class FormulaUnspecifiedError <UsageError; end
+class KegUnspecifiedError <UsageError; end
+
module HomebrewArgvExtension
def named
@named ||= reject{|arg| arg[0..0] == '-'}
@@ -31,7 +35,7 @@ module HomebrewArgvExtension
def formulae
require 'formula'
@formulae ||= downcased_unique_named.collect {|name| Formula.factory name}
- raise UsageError if @formulae.empty?
+ raise FormulaUnspecifiedError if @formulae.empty?
@formulae
end
def kegs
@@ -42,7 +46,7 @@ module HomebrewArgvExtension
raise "#{name} has multiple installed versions" if d.children.length > 1
Keg.new d.children[0]
end
- raise UsageError if @kegs.empty?
+ raise KegUnspecifiedError if @kegs.empty?
@kegs
end
@@ -113,5 +117,3 @@ To visit the Homebrew homepage type:
@downcased_unique_named ||= named.collect{|arg| arg.downcase}.uniq
end
end
-
-class UsageError <RuntimeError; end