Move --version logic into cmd/--version.rb.
This commit is contained in:
parent
16fbcd09da
commit
c53a52daee
@ -22,12 +22,6 @@ end
|
||||
|
||||
require "global"
|
||||
|
||||
if ARGV == %w[--version] || ARGV == %w[-v]
|
||||
puts "Homebrew #{HOMEBREW_VERSION}"
|
||||
puts "Homebrew/homebrew-core #{CoreTap.instance.version_string}"
|
||||
exit 0
|
||||
end
|
||||
|
||||
begin
|
||||
trap("INT", std_trap) # restore default CTRL-C handler
|
||||
|
||||
|
||||
@ -232,6 +232,7 @@ case "$HOMEBREW_COMMAND" in
|
||||
--repo) HOMEBREW_COMMAND="--repository" ;;
|
||||
environment) HOMEBREW_COMMAND="--env" ;;
|
||||
--config) HOMEBREW_COMMAND="config" ;;
|
||||
-v) HOMEBREW_COMMAND="--version" ;;
|
||||
esac
|
||||
|
||||
if [[ "$HOMEBREW_COMMAND" = "cask" ]]
|
||||
|
||||
@ -5,10 +5,9 @@ module Homebrew
|
||||
module_function
|
||||
|
||||
def __version
|
||||
# As a special case, `--version` is implemented directly in `brew.rb`. This
|
||||
# file merely serves as a container for the documentation. It also catches
|
||||
# the case where running `brew --version` with additional arguments would
|
||||
# produce a rather cryptic message about a non-existent `--version` command.
|
||||
raise UsageError
|
||||
odie "This command does not take arguments." if ARGV.any?
|
||||
|
||||
puts "Homebrew #{HOMEBREW_VERSION}"
|
||||
puts "Homebrew/homebrew-core #{CoreTap.instance.version_string}"
|
||||
end
|
||||
end
|
||||
|
||||
@ -83,6 +83,7 @@ HOMEBREW_INTERNAL_COMMAND_ALIASES = {
|
||||
"--repo" => "--repository",
|
||||
"environment" => "--env",
|
||||
"--config" => "config",
|
||||
"-v" => "--version",
|
||||
}.freeze
|
||||
|
||||
require "set"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user