Skip to content

Commit

Permalink
Merge pull request #1104 from adam12/ri-dump-silent-failure
Browse files Browse the repository at this point in the history
Abort with error message if `--dump` argument invalid
  • Loading branch information
nobu authored May 30, 2024
2 parents 546363d + 0536b83 commit 4ac4d6b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/rdoc/ri/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ def self.process_args argv
options = default_options

opts = OptionParser.new do |opt|
opt.accept File do |file,|
File.readable?(file) and not File.directory?(file) and file
end

opt.program_name = File.basename $0
opt.version = RDoc::VERSION
opt.release = nil
Expand Down Expand Up @@ -345,9 +341,17 @@ def self.process_args argv

opt.separator nil

opt.on("--dump=CACHE", File,
opt.on("--dump=CACHE",
"Dump data from an ri cache or data file.") do |value|
options[:dump_path] = value
unless File.readable?(value)
abort "#{value.inspect} is not readable"
end

if File.directory?(value)
abort "#{value.inspect} is a directory"
end

options[:dump_path] = File.new(value)
end
end

Expand Down

0 comments on commit 4ac4d6b

Please sign in to comment.