aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMartin Afanasjew2015-12-08 09:56:20 +0100
committerMartin Afanasjew2015-12-10 15:01:59 +0100
commit233a38ac9542db8eff93ffbcb305694da875bb69 (patch)
tree9e3ec4c97a29c068e14d0360ef2aeb3762049546 /Library
parent85181a067f0f79599d149775f8b2b57fa7388bfa (diff)
downloadbrew-233a38ac9542db8eff93ffbcb305694da875bb69.tar.bz2
brew.rb: improve handling of --version/-v option
Make both `--version` and `-v` print the Homebrew version and exit, if provided as first and sole argument. `brew --version` no longer accepts additional arguments (they were previously ignored). Otherwise interpret `brew -v <arguments>` as if `brew <arguments> -v` was executed instead (no change here), but no longer print a line with the Homebrew version. Closes Homebrew/homebrew#46790. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/brew.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/Library/brew.rb b/Library/brew.rb
index 9d5ed7a42..8c904c549 100755
--- a/Library/brew.rb
+++ b/Library/brew.rb
@@ -14,15 +14,12 @@ HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent.join("Homebrew")
$:.unshift(HOMEBREW_LIBRARY_PATH.to_s)
require "global"
-if ARGV.first == "--version"
- puts Homebrew.homebrew_version_string
+if ARGV == %w[--version] || ARGV == %w[-v]
+ puts "Homebrew #{Homebrew.homebrew_version_string}"
exit 0
elsif ARGV.first == "-v"
- puts "Homebrew #{Homebrew.homebrew_version_string}"
# Shift the -v to the end of the parameter list
ARGV << ARGV.shift
- # If no other arguments, just quit here.
- exit 0 if ARGV.length == 1
end
if OS.mac?