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