Don't throw if named.empty?
Generally this isn't desired or useful.
This commit is contained in:
parent
794a55a72b
commit
03ca3e24d0
@ -23,11 +23,7 @@
|
|||||||
#
|
#
|
||||||
module HomebrewArgvExtension
|
module HomebrewArgvExtension
|
||||||
def named
|
def named
|
||||||
raise UsageError if private_named.empty?
|
@named ||= reject{|arg| arg[0..0] == '-'}
|
||||||
private_named
|
|
||||||
end
|
|
||||||
def named_empty?
|
|
||||||
private_named.empty?
|
|
||||||
end
|
end
|
||||||
def options
|
def options
|
||||||
select {|arg| arg[0..0] == '-'}
|
select {|arg| arg[0..0] == '-'}
|
||||||
@ -108,15 +104,13 @@ Commands useful when contributing:
|
|||||||
|
|
||||||
To visit the Homebrew homepage type:
|
To visit the Homebrew homepage type:
|
||||||
brew home
|
brew home
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def private_named
|
|
||||||
@named ||= reject{|arg| arg[0..0] == '-'}
|
|
||||||
end
|
|
||||||
def downcased_unique_named
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
10
bin/brew
10
bin/brew
@ -80,7 +80,7 @@ begin
|
|||||||
dump_config
|
dump_config
|
||||||
|
|
||||||
when 'home', 'homepage'
|
when 'home', 'homepage'
|
||||||
if ARGV.named_empty?
|
if ARGV.named.empty?
|
||||||
exec "open", HOMEBREW_WWW
|
exec "open", HOMEBREW_WWW
|
||||||
else
|
else
|
||||||
exec "open", *ARGV.formulae.collect {|f| f.homepage}
|
exec "open", *ARGV.formulae.collect {|f| f.homepage}
|
||||||
@ -92,7 +92,7 @@ begin
|
|||||||
dirs -= ['Library', 'Cellar', '.git']
|
dirs -= ['Library', 'Cellar', '.git']
|
||||||
Dir.chdir HOMEBREW_PREFIX
|
Dir.chdir HOMEBREW_PREFIX
|
||||||
exec 'find', *dirs + %w[-type f ( ! -iname .ds_store ! -iname brew )]
|
exec 'find', *dirs + %w[-type f ( ! -iname .ds_store ! -iname brew )]
|
||||||
elsif ARGV.named_empty?
|
elsif ARGV.named.empty?
|
||||||
ENV['CLICOLOR']=nil
|
ENV['CLICOLOR']=nil
|
||||||
exec 'ls', *ARGV.options<<HOMEBREW_CELLAR if HOMEBREW_CELLAR.exist?
|
exec 'ls', *ARGV.options<<HOMEBREW_CELLAR if HOMEBREW_CELLAR.exist?
|
||||||
elsif ARGV.verbose? or not $stdout.tty?
|
elsif ARGV.verbose? or not $stdout.tty?
|
||||||
@ -110,7 +110,7 @@ begin
|
|||||||
end
|
end
|
||||||
|
|
||||||
when 'edit'
|
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
|
# 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,
|
# a UI for projects, so apologies if this wasn't what you expected,
|
||||||
# please improve it! :)
|
# please improve it! :)
|
||||||
@ -163,6 +163,8 @@ begin
|
|||||||
when 'create'
|
when 'create'
|
||||||
if ARGV.include? '--macports'
|
if ARGV.include? '--macports'
|
||||||
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
|
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
|
||||||
|
elsif ARGV.named.empty?
|
||||||
|
raise UsageError
|
||||||
else
|
else
|
||||||
exec_editor *ARGV.named.collect {|name| make name}
|
exec_editor *ARGV.named.collect {|name| make name}
|
||||||
end
|
end
|
||||||
@ -171,7 +173,7 @@ begin
|
|||||||
puts diy
|
puts diy
|
||||||
|
|
||||||
when 'info', 'abv'
|
when 'info', 'abv'
|
||||||
if ARGV.named_empty?
|
if ARGV.named.empty?
|
||||||
puts `ls #{HOMEBREW_CELLAR} | wc -l`.strip+" kegs, "+HOMEBREW_CELLAR.abv
|
puts `ls #{HOMEBREW_CELLAR} | wc -l`.strip+" kegs, "+HOMEBREW_CELLAR.abv
|
||||||
elsif ARGV[0][0..6] == 'http://'
|
elsif ARGV[0][0..6] == 'http://'
|
||||||
puts Pathname.new(ARGV.shift).version
|
puts Pathname.new(ARGV.shift).version
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user