@@ -122,7 +122,7 @@ def self.process_args argv
122
122
opt . summary_indent = ' ' * 4
123
123
124
124
opt . banner = <<-EOT
125
- Usage: #{ opt . program_name } [options] [names ...]
125
+ Usage: #{ opt . program_name } [options] [name ...]
126
126
127
127
Where name can be:
128
128
@@ -132,8 +132,8 @@ def self.process_args argv
132
132
133
133
gem_name: | gem_name:README | gem_name:History
134
134
135
- All class names may be abbreviated to their minimum unambiguous form. If a name
136
- is ambiguous, all valid options will be listed.
135
+ All class names may be abbreviated to their minimum unambiguous form.
136
+ If a name is ambiguous, all valid options will be listed.
137
137
138
138
A '.' matches either class or instance methods, while #method
139
139
matches only instance and ::method matches only class methods.
@@ -151,23 +151,23 @@ def self.process_args argv
151
151
#{ opt . program_name } zip
152
152
#{ opt . program_name } rdoc:README
153
153
154
- Note that shell quoting or escaping may be required for method names containing
155
- punctuation:
154
+ Note that shell quoting or escaping may be required for method names
155
+ containing punctuation:
156
156
157
157
#{ opt . program_name } 'Array.[]'
158
158
#{ opt . program_name } compact\\ !
159
159
160
- To see the default directories ri will search, run:
160
+ To see the default directories #{ opt . program_name } will search, run:
161
161
162
162
#{ opt . program_name } --list-doc-dirs
163
163
164
- Specifying the --system, --site, --home, --gems or --doc-dir options will
165
- limit ri to searching only the specified directories.
164
+ Specifying the --system, --site, --home, --gems, or --doc-dir options
165
+ will limit ri to searching only the specified directories.
166
166
167
- ri options may be set in the 'RI' environment variable.
167
+ ri options may be set in the RI environment variable.
168
168
169
- The ri pager can be set with the ' RI_PAGER' environment variable or the
170
- ' PAGER' environment variable.
169
+ The ri pager can be set with the RI_PAGER environment variable
170
+ or the PAGER environment variable.
171
171
EOT
172
172
173
173
opt . separator nil
@@ -199,15 +199,15 @@ def self.process_args argv
199
199
opt . separator nil
200
200
201
201
opt . on ( "--[no-]pager" ,
202
- "Send output directly to stdout ," ,
203
- "rather than to a pager ." ) do |use_pager |
202
+ "Send output to a pager ," ,
203
+ "rather than directly to stdout ." ) do |use_pager |
204
204
options [ :use_stdout ] = !use_pager
205
205
end
206
206
207
207
opt . separator nil
208
208
209
209
opt . on ( "-T" ,
210
- "Synonym for --no-pager" ) do
210
+ "Synonym for --no-pager. " ) do
211
211
options [ :use_stdout ] = true
212
212
end
213
213
@@ -220,7 +220,7 @@ def self.process_args argv
220
220
221
221
opt . separator nil
222
222
223
- opt . on ( "--server [ PORT]" , Integer ,
223
+ opt . on ( "--server[= PORT]" , Integer ,
224
224
"Run RDoc server on the given port." ,
225
225
"The default port is 8214." ) do |port |
226
226
options [ :server ] = port || 8214
@@ -235,13 +235,29 @@ def self.process_args argv
235
235
formatters -= %w[ html label test ] # remove useless output formats
236
236
237
237
opt . on ( "--format=NAME" , "-f" ,
238
- "Uses the selected formatter. The default" ,
238
+ "Use the selected formatter. The default" ,
239
239
"formatter is bs for paged output and ansi" ,
240
- "otherwise. Valid formatters are:" ,
241
- formatters . join ( ' ' ) , formatters ) do |value |
240
+ "otherwise. Valid formatters are:" ,
241
+ " #{ formatters . join ( ', ' ) } ." , formatters ) do |value |
242
242
options [ :formatter ] = RDoc ::Markup . const_get "To#{ value . capitalize } "
243
243
end
244
244
245
+ opt . separator nil
246
+
247
+ opt . on ( "--help" , "-h" ,
248
+ "Show help and exit." ) do
249
+ puts opts
250
+ exit
251
+ end
252
+
253
+ opt . separator nil
254
+
255
+ opt . on ( "--version" , "-v" ,
256
+ "Output version information and exit." ) do
257
+ puts "#{ opts . program_name } #{ opts . version } "
258
+ exit
259
+ end
260
+
245
261
opt . separator nil
246
262
opt . separator "Data source options:"
247
263
opt . separator nil
@@ -273,7 +289,7 @@ def self.process_args argv
273
289
"Do not include documentation from" ,
274
290
"the Ruby standard library, site_lib," ,
275
291
"installed gems, or ~/.rdoc." ,
276
- "Use with --doc-dir" ) do
292
+ "Use with --doc-dir. " ) do
277
293
options [ :use_system ] = false
278
294
options [ :use_site ] = false
279
295
options [ :use_gems ] = false
@@ -283,8 +299,8 @@ def self.process_args argv
283
299
opt . separator nil
284
300
285
301
opt . on ( "--[no-]system" ,
286
- "Include documentation from Ruby's standard " ,
287
- "library. Defaults to true." ) do |value |
302
+ "Include documentation from Ruby's" ,
303
+ "standard library. Defaults to true." ) do |value |
288
304
options [ :use_system ] = value
289
305
end
290
306
@@ -318,14 +334,14 @@ def self.process_args argv
318
334
opt . separator nil
319
335
320
336
opt . on ( "--[no-]profile" ,
321
- "Run with the ruby profiler" ) do |value |
337
+ "Run with the ruby profiler. " ) do |value |
322
338
options [ :profile ] = value
323
339
end
324
340
325
341
opt . separator nil
326
342
327
343
opt . on ( "--dump=CACHE" , File ,
328
- "Dumps data from an ri cache or data file" ) do |value |
344
+ "Dump data from an ri cache or data file. " ) do |value |
329
345
options [ :dump_path ] = value
330
346
end
331
347
end
0 commit comments