From 3b262d0b2349291ade041919a85fd2f75fd8528a Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 11 Aug 2009 00:27:18 +0100 Subject: Raise if ARGV.named and no named arguments --- Library/Homebrew/ARGV+yeast.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/ARGV+yeast.rb b/Library/Homebrew/ARGV+yeast.rb index c61e2d2c2..140e17ed3 100644 --- a/Library/Homebrew/ARGV+yeast.rb +++ b/Library/Homebrew/ARGV+yeast.rb @@ -17,7 +17,11 @@ # module HomebrewArgvExtension def named - reject{|arg| arg[0..0] == '-'}.collect{|arg| arg.downcase}.uniq + nn=namedp + raise UsageError if nn.empty? + end + def named_empty? + namedp.empty? end def options select {|arg| arg[0..0] == '-'} @@ -71,14 +75,22 @@ Usage: brew [--verbose] Commands: install formula ... [--debug] [--interactive] - rm formula ... + remove formula ... list formula ... - ln formula ... + link formula ... + home formula ... info [formula] [--github] - mk url + make url prune EOS end + +private + def namedp + nn=reject{|arg| arg[0..0] == '-'}.collect{|arg| arg.downcase}.uniq + end end +class UsageError