summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-08-13 18:43:21 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-08-13 18:43:21 +0000
commit180e588b3d06085520729953e59000dda415502c (patch)
tree9de41bc5c046dd5a5463e14f5f77661c1b7ec03d /lib
parentceb85657e7235fd3b2878de7b83914bef2f2d035 (diff)
Add Ri environment variable support
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rdoc/usage.rb44
1 files changed, 14 insertions, 30 deletions
diff --git a/lib/rdoc/usage.rb b/lib/rdoc/usage.rb
index d04f347f8e..afc9006ba9 100644
--- a/lib/rdoc/usage.rb
+++ b/lib/rdoc/usage.rb
@@ -9,8 +9,8 @@
#
# = Usage
#
-# RDoc::usage( [ exit_status ], [ section, ...], [options])
-# RDoc::usage_no_exit( [ section, ...], [options])
+# RDoc::usage( [ exit_status ], [ section, ...])
+# RDoc::usage_no_exit( [ section, ...])
#
# where:
#
@@ -25,18 +25,6 @@
# section is named 'Examples'. The section names are case
# insensitive.
#
-# options::
-# a hash of options. Option keys and values must implement +to_str+.
-# Supported options are:
-#
-# formatter::
-# plain | html | bs | ansi
-#
-# Select the output format: plain text, html, text using
-# backspace combinations to do underling and bold, or
-# text using ANSI escape sequences to colorize bold, italic, etc
-#
-#
# = Examples
#
# # Comment block describing usage
@@ -59,10 +47,9 @@
# RDoc::usage(99, 'Summary')
#
# # Display information in the Author and Copyright
-# # sections, then exit 0. Use the ANSI formatter
-# # (which colorized using ANSI escape sequences)
+# # sections, then exit 0.
#
-# RDoc::usage('Author', 'Copyright', :formatter => :ansi)
+# RDoc::usage('Author', 'Copyright')
#
# # Display information in the Author and Copyright
# # sections, but don't exit
@@ -124,16 +111,14 @@ module RDoc
format = "plain"
unless args.empty?
- if args[-1].class == Hash
- options = args.pop
- o_format = options[:formatter] || options['formatter']
- format = o_format.to_s if o_format
- end
flow = extract_sections(flow, args)
end
options = RI::Options.instance
- formatter = RI::TextFormatter.for(format).new(options, " ")
+ if ENV["RI"]
+ options.parse
+ end
+ formatter = options.formatter.new(options, " ")
formatter.display_flow(flow)
end
@@ -194,12 +179,18 @@ module RDoc
end
end
end
+ if result.empty?
+ puts "Note to developer: requested section(s) [#{sections.join(', ')}] " +
+ "not found"
+ result = flow
+ end
result
end
#####
# Report the fact that no doc comment count be found
def RDoc.no_comment
+fail "xxx"
$stderr.puts "No usage information available for this program"
nil
end
@@ -208,13 +199,6 @@ end
if $0 == __FILE__
- opts = {}
- if ARGV[0] && ARGV[0] =~ /^(plain|ansi|html|bs)$/
- opts[:formatter] = ARGV.shift
- end
-
- ARGV.push opts unless opts.empty?
-
RDoc::usage(*ARGV)
end