Show an error and exit
# File rdoc/options.rb, line 263 def OptionList.error(msg) $stderr.puts $stderr.puts msg $stderr.puts "\nFor help on options, try 'rdoc --help'\n\n" exit 1 end
# File rdoc/options.rb, line 320 def OptionList.help_output OptionList.strip_output(<<-EOT) How RDoc generates output depends on the output formatter being used, and on the options you give. - HTML output is normally produced into a number of separate files (one per class, module, and file, along with various indices). These files will appear in the directory given by the --op option (doc/ by default). - XML output by default is written to standard output. If a --opname option is given, the output will instead be written to a file with that name in the output directory. - .chm files (Windows help files) are written in the --op directory. If an --opname parameter is present, that name is used, otherwise the file will be called rdoc.chm. For information on other RDoc options, use "rdoc --help". EOT exit 0 end
# File rdoc/options.rb, line 243 def OptionList.options OPTION_LIST.map do |long, short, arg,| [ long, short, arg ? GetoptLong::REQUIRED_ARGUMENT : GetoptLong::NO_ARGUMENT ] end end
# File rdoc/options.rb, line 253 def OptionList.strip_output(text) text =~ /^\s+/ leading_spaces = $& text.gsub!(/^#{leading_spaces}/, '') $stdout.puts text end
Show usage and exit
# File rdoc/options.rb, line 272 def OptionList.usage(generator_names) puts puts(VERSION_STRING) puts name = File.basename($0) OptionList.strip_output(<<-EOT) Usage: #{name} [options] [names...] Files are parsed, and the information they contain collected, before any output is produced. This allows cross references between all files to be resolved. If a name is a directory, it is traversed. If no names are specified, all Ruby files in the current directory (and subdirectories) are processed. Options: EOT OPTION_LIST.each do |long, short, arg, desc| opt = sprintf("%20s", "#{long}, #{short}") oparg = sprintf("%-7s", arg) print "#{opt} #{oparg}" desc = desc.split("\n") if arg.nil? || arg.length < 7 puts desc.shift else puts end desc.each do |line| puts(" "*28 + line) end puts end puts "\nAvailable output formatters: " + generator_names.sort.join(', ') + "\n\n" puts "For information on where the output goes, use\n\n" puts " rdoc --help-output\n\n" exit 0 end