Handle certain ARGV parameters before certain error checks
This commit is contained in:
parent
8eb97a7db5
commit
af088a8a33
38
bin/brew
38
bin/brew
@ -16,13 +16,31 @@ end
|
|||||||
|
|
||||||
$:.unshift homebrew_rubylib_path
|
$:.unshift homebrew_rubylib_path
|
||||||
require 'global'
|
require 'global'
|
||||||
require 'brew.h'
|
|
||||||
|
|
||||||
if %w[/ /usr].include? HOMEBREW_PREFIX.to_s then abort <<-EOS
|
case ARGV.first
|
||||||
You have placed Homebrew at the prefix: #{HOMEBREW_PREFIX}
|
when '--cache'
|
||||||
This is not currently supported. Voice your support for this feature at:
|
puts HOMEBREW_CACHE
|
||||||
#{HOMEBREW_WWW}
|
exit 0
|
||||||
EOS
|
when '-h', '--help', '--usage', '-?'
|
||||||
|
puts ARGV.usage
|
||||||
|
exit 0
|
||||||
|
when '--version'
|
||||||
|
puts HOMEBREW_VERSION
|
||||||
|
exit 0
|
||||||
|
when '-v'
|
||||||
|
if ARGV.length > 1
|
||||||
|
puts "Homebrew #{HOMEBREW_VERSION}"
|
||||||
|
# continue in verbose mode
|
||||||
|
ARGV << ARGV.shift
|
||||||
|
else
|
||||||
|
puts HOMEBREW_VERSION
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
case HOMEBREW_PREFIX.to_s when '/', '/usr'
|
||||||
|
# it may work, but I only see pain this route and don't want to support it
|
||||||
|
abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}"
|
||||||
end
|
end
|
||||||
if MACOS_VERSION < 10.5
|
if MACOS_VERSION < 10.5
|
||||||
abort "Homebrew requires Leopard or higher, but you could fork it and fix that..."
|
abort "Homebrew requires Leopard or higher, but you could fork it and fix that..."
|
||||||
@ -36,11 +54,11 @@ end
|
|||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
require 'brew.h'
|
||||||
|
|
||||||
case ARGV.shift
|
case ARGV.shift
|
||||||
when '--prefix' then puts HOMEBREW_PREFIX
|
when '--prefix'
|
||||||
when '--cache' then puts HOMEBREW_CACHE
|
puts HOMEBREW_PREFIX
|
||||||
when '-h', '--help', '--usage', '-?' then puts ARGV.usage
|
|
||||||
when '-v', '--version' then puts HOMEBREW_VERSION
|
|
||||||
|
|
||||||
when 'home', 'homepage'
|
when 'home', 'homepage'
|
||||||
if ARGV.named_empty?
|
if ARGV.named_empty?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user