mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/optparse.rb: --version takes an optional argument; "all" or a list of package names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
782b6ceac3
commit
89c73f237e
3 changed files with 59 additions and 4 deletions
|
@ -609,11 +609,20 @@ Default options, which never appear in option summary.
|
|||
puts ARGV.options
|
||||
exit
|
||||
end
|
||||
DefaultList.long['version'] = Switch::NoArgument.new do
|
||||
if v = ARGV.options.ver
|
||||
puts v
|
||||
exit
|
||||
DefaultList.long['version'] = Switch::OptionalArgument.new do |pkg|
|
||||
if pkg
|
||||
begin
|
||||
require 'optparse/version'
|
||||
rescue LoadError
|
||||
pkg = nil
|
||||
else
|
||||
show_version(*pkg.split(/,/))
|
||||
end
|
||||
end
|
||||
unless pkg
|
||||
puts v if v = ARGV.options.ver
|
||||
end
|
||||
exit
|
||||
end
|
||||
|
||||
=begin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue