brew/Library/Homebrew/cmd/--version.rb

29 lines
701 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2019-04-17 18:25:08 +09:00
require "cli/parser"
module Homebrew
2016-09-26 01:44:51 +02:00
module_function
2019-01-30 21:29:54 +00:00
def __version_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--version`
2019-08-06 14:22:24 -04:00
Print the version numbers of Homebrew, Homebrew/homebrew-core and Homebrew/homebrew-cask
(if tapped) to standard output.
2019-01-30 21:29:54 +00:00
EOS
end
end
def __version
2019-01-30 21:29:54 +00:00
__version_args.parse
odie "This command does not take arguments." if ARGV.any?
puts "Homebrew #{HOMEBREW_VERSION}"
2018-09-06 06:07:43 +02:00
puts "#{CoreTap.instance.full_name} #{CoreTap.instance.version_string}"
puts "#{Tap.default_cask_tap.full_name} #{Tap.default_cask_tap.version_string}" if Tap.default_cask_tap.installed?
end
end