From dbd8de71489c7cbc64d5ee5ee58917f96a69a447 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:54 +0000 Subject: [PATCH] --version: use CLI::Parser. --- Library/Homebrew/cmd/--version.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/--version.rb b/Library/Homebrew/cmd/--version.rb index a05369e25b..bd4a222821 100644 --- a/Library/Homebrew/cmd/--version.rb +++ b/Library/Homebrew/cmd/--version.rb @@ -1,10 +1,22 @@ -#: * `--version`: -#: Print the version number of Homebrew to standard output and exit. +require "cli_parser" module Homebrew module_function + def __version_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--version` + + Print the version number of Homebrew, Homebrew/homebrew-core and Homebrew/homebrew-cask + (if tapped) to standard output and exit. + EOS + end + end + def __version + __version_args.parse + odie "This command does not take arguments." if ARGV.any? puts "Homebrew #{HOMEBREW_VERSION}"