aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/extend/ARGV.rb16
-rwxr-xr-xbin/brew10
2 files changed, 11 insertions, 15 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index 62ac933f7..e7585edbc 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -23,11 +23,7 @@
#
module HomebrewArgvExtension
def named
- raise UsageError if private_named.empty?
- private_named
- end
- def named_empty?
- private_named.empty?
+ @named ||= reject{|arg| arg[0..0] == '-'}
end
def options
select {|arg| arg[0..0] == '-'}
@@ -108,15 +104,13 @@ Commands useful when contributing:
To visit the Homebrew homepage type:
brew home
- EOS
+ EOS
end
-private
- def private_named
- @named ||= reject{|arg| arg[0..0] == '-'}
- end
+ private
+
def downcased_unique_named
- @downcased_unique_named ||= private_named.collect{|arg| arg.downcase}.uniq
+ @downcased_unique_named ||= named.collect{|arg| arg.downcase}.uniq
end
end
diff --git a/bin/brew b/bin/brew
index b7e255d84..437be8c73 100755
--- a/bin/brew
+++ b/bin/brew
@@ -80,7 +80,7 @@ begin
dump_config
when 'home', 'homepage'
- if ARGV.named_empty?
+ if ARGV.named.empty?
exec "open", HOMEBREW_WWW
else
exec "open", *ARGV.formulae.collect {|f| f.homepage}
@@ -92,7 +92,7 @@ begin
dirs -= ['Library', 'Cellar', '.git']
Dir.chdir HOMEBREW_PREFIX
exec 'find', *dirs + %w[-type f ( ! -iname .ds_store ! -iname brew )]
- elsif ARGV.named_empty?
+ elsif ARGV.named.empty?
ENV['CLICOLOR']=nil
exec 'ls', *ARGV.options<<HOMEBREW_CELLAR if HOMEBREW_CELLAR.exist?
elsif ARGV.verbose? or not $stdout.tty?
@@ -110,7 +110,7 @@ begin
end
when 'edit'
- if ARGV.named_empty?
+ if ARGV.named.empty?
# EDITOR isn't a good fit here, we need a GUI client that actually has
# a UI for projects, so apologies if this wasn't what you expected,
# please improve it! :)
@@ -163,6 +163,8 @@ begin
when 'create'
if ARGV.include? '--macports'
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
+ elsif ARGV.named.empty?
+ raise UsageError
else
exec_editor *ARGV.named.collect {|name| make name}
end
@@ -171,7 +173,7 @@ begin
puts diy
when 'info', 'abv'
- if ARGV.named_empty?
+ if ARGV.named.empty?
puts `ls #{HOMEBREW_CELLAR} | wc -l`.strip+" kegs, "+HOMEBREW_CELLAR.abv
elsif ARGV[0][0..6] == 'http://'
puts Pathname.new(ARGV.shift).version