mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rdoc/ri/driver.rb (RDoc::RI::Driver.setup_options)
(RDoc::RI::Driver.fixup_options): split from process_args. libraries should not parse ARGV inside, since it's a task of applications, not libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
75d694e535
commit
9bc2e3280a
2 changed files with 24 additions and 12 deletions
|
@ -1,3 +1,10 @@
|
|||
Thu Sep 16 21:31:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/rdoc/ri/driver.rb (RDoc::RI::Driver.setup_options)
|
||||
(RDoc::RI::Driver.fixup_options): split from process_args.
|
||||
libraries should not parse ARGV inside, since it's a task of
|
||||
applications, not libraries.
|
||||
|
||||
Thu Sep 16 21:02:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/rdoc/ri/paths.rb (RDoc::RI::Paths.each): HOMEDIR can be nil
|
||||
|
|
|
@ -97,10 +97,23 @@ class RDoc::RI::Driver
|
|||
##
|
||||
# Parses +argv+ and returns a Hash of options
|
||||
|
||||
def self.process_args argv
|
||||
def self.process_args argv = []
|
||||
options = default_options
|
||||
opts = OptionParser.new
|
||||
setup_options(opts, options)
|
||||
|
||||
opts = OptionParser.new do |opt|
|
||||
argv = ENV['RI'].to_s.split.concat argv
|
||||
opts.parse!(argv)
|
||||
|
||||
fixup_options(options, argv)
|
||||
|
||||
rescue OptionParser::ParseError => e
|
||||
puts opts, nil, e
|
||||
abort
|
||||
end
|
||||
|
||||
def self.setup_options(opt, options)
|
||||
begin
|
||||
opt.accept File do |file,|
|
||||
File.readable?(file) and not File.directory?(file) and file
|
||||
end
|
||||
|
@ -274,11 +287,9 @@ Options may also be set in the 'RI' environment variable.
|
|||
options[:dump_path] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
argv = ENV['RI'].to_s.split.concat argv
|
||||
|
||||
opts.parse! argv
|
||||
|
||||
def self.fixup_options(options, argv)
|
||||
options[:names] = argv
|
||||
|
||||
options[:use_stdout] ||= !$stdout.tty?
|
||||
|
@ -286,12 +297,6 @@ Options may also be set in the 'RI' environment variable.
|
|||
options[:width] ||= 72
|
||||
|
||||
options
|
||||
|
||||
rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
|
||||
puts opts
|
||||
puts
|
||||
puts e
|
||||
exit 1
|
||||
end
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue