optparse 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rdoc_options +1 -0
- data/BSDL +22 -0
- data/README.md +1 -1
- data/doc/optparse/argument_converters.rdoc +1 -1
- data/doc/optparse/option_params.rdoc +25 -14
- data/doc/optparse/ruby/matched_values.rb +6 -0
- data/doc/optparse/tutorial.rdoc +16 -16
- data/lib/optparse.rb +91 -48
- metadata +9 -12
- data/ChangeLog +0 -275
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75528067add8b99394cfaa038be937a623a7fda39714a19d06e6547f0fbd0d3e
|
|
4
|
+
data.tar.gz: 9587c77cbedaad767f474737cd226f120706e56432c4dc61dda83efc8a157f63
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 402d2a4aa4f89f43250e459d8a254049b977c33882c31069d17ed2cc2057b30cc4113372bf3ee082c000dbbc80a4c92a1e0f4dbad6a9ab6798605ff68721a33c
|
|
7
|
+
data.tar.gz: 0a2cc0d212fd7d70aa8822bd7d93f3ea772d19952b99307660235db613d33b637ac5e3d9334a4cf5dd103573ce2382be9f8d4d664b73f4f5644fd3e9ae537434
|
data/.rdoc_options
CHANGED
data/BSDL
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions
|
|
5
|
+
are met:
|
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
22
|
+
SUCH DAMAGE.
|
data/README.md
CHANGED
|
@@ -50,7 +50,7 @@ p ARGV
|
|
|
50
50
|
|
|
51
51
|
## Development
|
|
52
52
|
|
|
53
|
-
After checking out the repo, run `
|
|
53
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake test` to run the tests.
|
|
54
54
|
|
|
55
55
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
56
56
|
|
|
@@ -377,4 +377,4 @@ Executions:
|
|
|
377
377
|
$ ruby match_converter.rb --capitalize foo
|
|
378
378
|
["Foo", String]
|
|
379
379
|
$ ruby match_converter.rb --capitalize "foo bar"
|
|
380
|
-
match_converter.rb:9:in
|
|
380
|
+
match_converter.rb:9:in '<main>': invalid argument: --capitalize foo bar (OptionParser::InvalidArgument)
|
|
@@ -91,7 +91,7 @@ Executions:
|
|
|
91
91
|
Usage: short_required [options]
|
|
92
92
|
-xXXX Short name with required argument
|
|
93
93
|
$ ruby short_required.rb -x
|
|
94
|
-
short_required.rb:6:in
|
|
94
|
+
short_required.rb:6:in '<main>': missing argument: -x (OptionParser::MissingArgument)
|
|
95
95
|
$ ruby short_required.rb -x FOO
|
|
96
96
|
["-x", "FOO"]
|
|
97
97
|
|
|
@@ -181,7 +181,7 @@ Executions:
|
|
|
181
181
|
Usage: long_required [options]
|
|
182
182
|
--xxx XXX Long name with required argument
|
|
183
183
|
$ ruby long_required.rb --xxx
|
|
184
|
-
long_required.rb:6:in
|
|
184
|
+
long_required.rb:6:in '<main>': missing argument: --xxx (OptionParser::MissingArgument)
|
|
185
185
|
$ ruby long_required.rb --xxx FOO
|
|
186
186
|
["--xxx", "FOO"]
|
|
187
187
|
|
|
@@ -243,11 +243,11 @@ Usage: mixed_names [options]
|
|
|
243
243
|
$ ruby mixed_names.rb --xxx
|
|
244
244
|
["--xxx", true]
|
|
245
245
|
$ ruby mixed_names.rb -y
|
|
246
|
-
mixed_names.rb:12:in
|
|
246
|
+
mixed_names.rb:12:in '<main>': missing argument: -y (OptionParser::MissingArgument)
|
|
247
247
|
$ ruby mixed_names.rb -y FOO
|
|
248
248
|
["--yyy", "FOO"]
|
|
249
249
|
$ ruby mixed_names.rb --yyy
|
|
250
|
-
mixed_names.rb:12:in
|
|
250
|
+
mixed_names.rb:12:in '<main>': missing argument: --yyy (OptionParser::MissingArgument)
|
|
251
251
|
$ ruby mixed_names.rb --yyy BAR
|
|
252
252
|
["--yyy", "BAR"]
|
|
253
253
|
$ ruby mixed_names.rb -z
|
|
@@ -279,7 +279,7 @@ Executions:
|
|
|
279
279
|
Usage: argument_keywords [options]
|
|
280
280
|
-x, --xxx Required argument
|
|
281
281
|
$ ruby argument_styles.rb --xxx
|
|
282
|
-
argument_styles.rb:6:in
|
|
282
|
+
argument_styles.rb:6:in '<main>': missing argument: --xxx (OptionParser::MissingArgument)
|
|
283
283
|
$ ruby argument_styles.rb --xxx FOO
|
|
284
284
|
["--xxx", "FOO"]
|
|
285
285
|
|
|
@@ -298,7 +298,7 @@ Executions:
|
|
|
298
298
|
Usage: argument_strings [options]
|
|
299
299
|
-x, --xxx=XXX Required argument
|
|
300
300
|
$ ruby argument_strings.rb --xxx
|
|
301
|
-
argument_strings.rb:9:in
|
|
301
|
+
argument_strings.rb:9:in '<main>': missing argument: --xxx (OptionParser::MissingArgument)
|
|
302
302
|
$ ruby argument_strings.rb --xxx FOO
|
|
303
303
|
["--xxx", "FOO"]
|
|
304
304
|
|
|
@@ -331,7 +331,7 @@ Executions:
|
|
|
331
331
|
-xXXX Values for required argument
|
|
332
332
|
-y [YYY] Values for optional argument
|
|
333
333
|
$ ruby explicit_array_values.rb -x
|
|
334
|
-
explicit_array_values.rb:9:in
|
|
334
|
+
explicit_array_values.rb:9:in '<main>': missing argument: -x (OptionParser::MissingArgument)
|
|
335
335
|
$ ruby explicit_array_values.rb -x foo
|
|
336
336
|
["-x", "foo"]
|
|
337
337
|
$ ruby explicit_array_values.rb -x f
|
|
@@ -339,9 +339,9 @@ Executions:
|
|
|
339
339
|
$ ruby explicit_array_values.rb -x bar
|
|
340
340
|
["-x", "bar"]
|
|
341
341
|
$ ruby explicit_array_values.rb -y ba
|
|
342
|
-
explicit_array_values.rb:9:in
|
|
342
|
+
explicit_array_values.rb:9:in '<main>': ambiguous argument: -y ba (OptionParser::AmbiguousArgument)
|
|
343
343
|
$ ruby explicit_array_values.rb -x baz
|
|
344
|
-
explicit_array_values.rb:9:in
|
|
344
|
+
explicit_array_values.rb:9:in '<main>': invalid argument: -x baz (OptionParser::InvalidArgument)
|
|
345
345
|
|
|
346
346
|
|
|
347
347
|
===== Explicit Values in Hash
|
|
@@ -361,7 +361,7 @@ Executions:
|
|
|
361
361
|
-xXXX Values for required argument
|
|
362
362
|
-y [YYY] Values for optional argument
|
|
363
363
|
$ ruby explicit_hash_values.rb -x
|
|
364
|
-
explicit_hash_values.rb:9:in
|
|
364
|
+
explicit_hash_values.rb:9:in '<main>': missing argument: -x (OptionParser::MissingArgument)
|
|
365
365
|
$ ruby explicit_hash_values.rb -x foo
|
|
366
366
|
["-x", 0]
|
|
367
367
|
$ ruby explicit_hash_values.rb -x f
|
|
@@ -369,7 +369,7 @@ Executions:
|
|
|
369
369
|
$ ruby explicit_hash_values.rb -x bar
|
|
370
370
|
["-x", 1]
|
|
371
371
|
$ ruby explicit_hash_values.rb -x baz
|
|
372
|
-
explicit_hash_values.rb:9:in
|
|
372
|
+
explicit_hash_values.rb:9:in '<main>': invalid argument: -x baz (OptionParser::InvalidArgument)
|
|
373
373
|
$ ruby explicit_hash_values.rb -y
|
|
374
374
|
["-y", nil]
|
|
375
375
|
$ ruby explicit_hash_values.rb -y baz
|
|
@@ -377,14 +377,15 @@ Executions:
|
|
|
377
377
|
$ ruby explicit_hash_values.rb -y bat
|
|
378
378
|
["-y", 3]
|
|
379
379
|
$ ruby explicit_hash_values.rb -y ba
|
|
380
|
-
explicit_hash_values.rb:9:in
|
|
380
|
+
explicit_hash_values.rb:9:in '<main>': ambiguous argument: -y ba (OptionParser::AmbiguousArgument)
|
|
381
381
|
$ ruby explicit_hash_values.rb -y bam
|
|
382
382
|
["-y", nil]
|
|
383
383
|
|
|
384
384
|
==== Argument Value Patterns
|
|
385
385
|
|
|
386
386
|
You can restrict permissible argument values
|
|
387
|
-
by specifying a Regexp that the given argument must match
|
|
387
|
+
by specifying a +Regexp+ that the given argument must match,
|
|
388
|
+
or a +Range+ or +Array+ that the converted value must be included in.
|
|
388
389
|
|
|
389
390
|
File +matched_values.rb+ defines options with matched argument values.
|
|
390
391
|
|
|
@@ -395,12 +396,22 @@ Executions:
|
|
|
395
396
|
$ ruby matched_values.rb --help
|
|
396
397
|
Usage: matched_values [options]
|
|
397
398
|
--xxx XXX Matched values
|
|
399
|
+
--yyy YYY Check by range
|
|
400
|
+
--zzz ZZZ Check by list
|
|
398
401
|
$ ruby matched_values.rb --xxx foo
|
|
399
402
|
["--xxx", "foo"]
|
|
400
403
|
$ ruby matched_values.rb --xxx FOO
|
|
401
404
|
["--xxx", "FOO"]
|
|
402
405
|
$ ruby matched_values.rb --xxx bar
|
|
403
|
-
matched_values.rb:
|
|
406
|
+
matched_values.rb:12:in '<main>': invalid argument: --xxx bar (OptionParser::InvalidArgument)
|
|
407
|
+
$ ruby matched_values.rb --yyy 1
|
|
408
|
+
["--yyy", 1]
|
|
409
|
+
$ ruby matched_values.rb --yyy 4
|
|
410
|
+
matched_values.rb:12:in '<main>': invalid argument: --yyy 4 (OptionParser::InvalidArgument)
|
|
411
|
+
$ ruby matched_values.rb --zzz 1
|
|
412
|
+
["--zzz", 1]
|
|
413
|
+
$ ruby matched_values.rb --zzz 2
|
|
414
|
+
matched_values.rb:12:in '<main>': invalid argument: --zzz 2 (OptionParser::InvalidArgument)
|
|
404
415
|
|
|
405
416
|
=== Argument Converters
|
|
406
417
|
|
|
@@ -3,4 +3,10 @@ parser = OptionParser.new
|
|
|
3
3
|
parser.on('--xxx XXX', /foo/i, 'Matched values') do |value|
|
|
4
4
|
p ['--xxx', value]
|
|
5
5
|
end
|
|
6
|
+
parser.on('--yyy YYY', Integer, 'Check by range', 1..3) do |value|
|
|
7
|
+
p ['--yyy', value]
|
|
8
|
+
end
|
|
9
|
+
parser.on('--zzz ZZZ', Integer, 'Check by list', [1, 3, 4]) do |value|
|
|
10
|
+
p ['--zzz', value]
|
|
11
|
+
end
|
|
6
12
|
parser.parse!
|
data/doc/optparse/tutorial.rdoc
CHANGED
|
@@ -111,7 +111,7 @@ Executions:
|
|
|
111
111
|
["x", true]
|
|
112
112
|
["input_file.txt", "output_file.txt"]
|
|
113
113
|
$ ruby basic.rb -a
|
|
114
|
-
basic.rb:16:in
|
|
114
|
+
basic.rb:16:in '<main>': invalid option: -a (OptionParser::InvalidOption)
|
|
115
115
|
|
|
116
116
|
=== Defining Options
|
|
117
117
|
|
|
@@ -232,11 +232,11 @@ Executions:
|
|
|
232
232
|
$ ruby mixed_names.rb --xxx
|
|
233
233
|
["--xxx", true]
|
|
234
234
|
$ ruby mixed_names.rb -y
|
|
235
|
-
mixed_names.rb:12:in
|
|
235
|
+
mixed_names.rb:12:in '<main>': missing argument: -y (OptionParser::MissingArgument)
|
|
236
236
|
$ ruby mixed_names.rb -y FOO
|
|
237
237
|
["--yyy", "FOO"]
|
|
238
238
|
$ ruby mixed_names.rb --yyy
|
|
239
|
-
mixed_names.rb:12:in
|
|
239
|
+
mixed_names.rb:12:in '<main>': missing argument: --yyy (OptionParser::MissingArgument)
|
|
240
240
|
$ ruby mixed_names.rb --yyy BAR
|
|
241
241
|
["--yyy", "BAR"]
|
|
242
242
|
$ ruby mixed_names.rb -z
|
|
@@ -270,9 +270,9 @@ Executions:
|
|
|
270
270
|
$ ruby name_abbrev.rb --draft
|
|
271
271
|
["--draft", true]
|
|
272
272
|
$ ruby name_abbrev.rb --d
|
|
273
|
-
name_abbrev.rb:9:in
|
|
273
|
+
name_abbrev.rb:9:in '<main>': ambiguous option: --d (OptionParser::AmbiguousOption)
|
|
274
274
|
$ ruby name_abbrev.rb --dr
|
|
275
|
-
name_abbrev.rb:9:in
|
|
275
|
+
name_abbrev.rb:9:in '<main>': ambiguous option: --dr (OptionParser::AmbiguousOption)
|
|
276
276
|
$ ruby name_abbrev.rb --dry
|
|
277
277
|
["--dry-run", true]
|
|
278
278
|
$ ruby name_abbrev.rb --dra
|
|
@@ -285,7 +285,7 @@ You can disable abbreviation using method +require_exact+.
|
|
|
285
285
|
Executions:
|
|
286
286
|
|
|
287
287
|
$ ruby no_abbreviation.rb --dry-ru
|
|
288
|
-
no_abbreviation.rb:10:in
|
|
288
|
+
no_abbreviation.rb:10:in '<main>': invalid option: --dry-ru (OptionParser::InvalidOption)
|
|
289
289
|
$ ruby no_abbreviation.rb --dry-run
|
|
290
290
|
["--dry-run", true]
|
|
291
291
|
|
|
@@ -323,7 +323,7 @@ Executions:
|
|
|
323
323
|
Omitting a required argument raises an error:
|
|
324
324
|
|
|
325
325
|
$ ruby required_argument.rb -x
|
|
326
|
-
required_argument.rb:9:in
|
|
326
|
+
required_argument.rb:9:in '<main>': missing argument: -x (OptionParser::MissingArgument)
|
|
327
327
|
|
|
328
328
|
==== Option with Optional Argument
|
|
329
329
|
|
|
@@ -369,7 +369,7 @@ Executions:
|
|
|
369
369
|
$ ruby argument_abbreviation.rb --xxx A
|
|
370
370
|
["--xxx", "ABC"]
|
|
371
371
|
$ ruby argument_abbreviation.rb --xxx c
|
|
372
|
-
argument_abbreviation.rb:9:in
|
|
372
|
+
argument_abbreviation.rb:9:in '<main>': invalid argument: --xxx c (OptionParser::InvalidArgument)
|
|
373
373
|
$ ruby argument_abbreviation.rb --yyy a --yyy d
|
|
374
374
|
["--yyy", "XYZ"]
|
|
375
375
|
["--yyy", "FOO"]
|
|
@@ -403,7 +403,7 @@ Executions:
|
|
|
403
403
|
-xXXX Values for required argument
|
|
404
404
|
-y [YYY] Values for optional argument
|
|
405
405
|
$ ruby explicit_array_values.rb -x
|
|
406
|
-
explicit_array_values.rb:9:in
|
|
406
|
+
explicit_array_values.rb:9:in '<main>': missing argument: -x (OptionParser::MissingArgument)
|
|
407
407
|
$ ruby explicit_array_values.rb -x foo
|
|
408
408
|
["-x", "foo"]
|
|
409
409
|
$ ruby explicit_array_values.rb -x f
|
|
@@ -411,9 +411,9 @@ Executions:
|
|
|
411
411
|
$ ruby explicit_array_values.rb -x bar
|
|
412
412
|
["-x", "bar"]
|
|
413
413
|
$ ruby explicit_array_values.rb -y ba
|
|
414
|
-
explicit_array_values.rb:9:in
|
|
414
|
+
explicit_array_values.rb:9:in '<main>': ambiguous argument: -y ba (OptionParser::AmbiguousArgument)
|
|
415
415
|
$ ruby explicit_array_values.rb -x baz
|
|
416
|
-
explicit_array_values.rb:9:in
|
|
416
|
+
explicit_array_values.rb:9:in '<main>': invalid argument: -x baz (OptionParser::InvalidArgument)
|
|
417
417
|
|
|
418
418
|
|
|
419
419
|
===== Explicit Values in Hash
|
|
@@ -433,7 +433,7 @@ Executions:
|
|
|
433
433
|
-xXXX Values for required argument
|
|
434
434
|
-y [YYY] Values for optional argument
|
|
435
435
|
$ ruby explicit_hash_values.rb -x
|
|
436
|
-
explicit_hash_values.rb:9:in
|
|
436
|
+
explicit_hash_values.rb:9:in '<main>': missing argument: -x (OptionParser::MissingArgument)
|
|
437
437
|
$ ruby explicit_hash_values.rb -x foo
|
|
438
438
|
["-x", 0]
|
|
439
439
|
$ ruby explicit_hash_values.rb -x f
|
|
@@ -441,7 +441,7 @@ Executions:
|
|
|
441
441
|
$ ruby explicit_hash_values.rb -x bar
|
|
442
442
|
["-x", 1]
|
|
443
443
|
$ ruby explicit_hash_values.rb -x baz
|
|
444
|
-
explicit_hash_values.rb:9:in
|
|
444
|
+
explicit_hash_values.rb:9:in '<main>': invalid argument: -x baz (OptionParser::InvalidArgument)
|
|
445
445
|
$ ruby explicit_hash_values.rb -y
|
|
446
446
|
["-y", nil]
|
|
447
447
|
$ ruby explicit_hash_values.rb -y baz
|
|
@@ -449,7 +449,7 @@ Executions:
|
|
|
449
449
|
$ ruby explicit_hash_values.rb -y bat
|
|
450
450
|
["-y", 3]
|
|
451
451
|
$ ruby explicit_hash_values.rb -y ba
|
|
452
|
-
explicit_hash_values.rb:9:in
|
|
452
|
+
explicit_hash_values.rb:9:in '<main>': ambiguous argument: -y ba (OptionParser::AmbiguousArgument)
|
|
453
453
|
$ ruby explicit_hash_values.rb -y bam
|
|
454
454
|
["-y", nil]
|
|
455
455
|
|
|
@@ -472,7 +472,7 @@ Executions:
|
|
|
472
472
|
$ ruby matched_values.rb --xxx FOO
|
|
473
473
|
["--xxx", "FOO"]
|
|
474
474
|
$ ruby matched_values.rb --xxx bar
|
|
475
|
-
matched_values.rb:6:in
|
|
475
|
+
matched_values.rb:6:in '<main>': invalid argument: --xxx bar (OptionParser::InvalidArgument)
|
|
476
476
|
|
|
477
477
|
=== Keyword Argument +into+
|
|
478
478
|
|
|
@@ -524,7 +524,7 @@ Executions:
|
|
|
524
524
|
-y, --yyyYYY Short and long, required argument
|
|
525
525
|
-z, --zzz [ZZZ] Short and long, optional argument
|
|
526
526
|
$ ruby missing_options.rb --yyy FOO
|
|
527
|
-
missing_options.rb:11:in
|
|
527
|
+
missing_options.rb:11:in '<main>': Missing required options: [:xxx, :zzz] (RuntimeError)
|
|
528
528
|
|
|
529
529
|
==== Default Values for Options
|
|
530
530
|
|
data/lib/optparse.rb
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#
|
|
8
8
|
# See OptionParser for documentation.
|
|
9
9
|
#
|
|
10
|
+
require 'set' unless defined?(Set)
|
|
10
11
|
|
|
11
12
|
#--
|
|
12
13
|
# == Developer Documentation (not for RDoc output)
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
# Used:
|
|
143
144
|
#
|
|
144
145
|
# $ ruby optparse-test.rb -r
|
|
145
|
-
# optparse-test.rb:9:in
|
|
146
|
+
# optparse-test.rb:9:in '<main>': missing argument: -r (OptionParser::MissingArgument)
|
|
146
147
|
# $ ruby optparse-test.rb -r my-library
|
|
147
148
|
# You required my-library!
|
|
148
149
|
#
|
|
@@ -235,7 +236,7 @@
|
|
|
235
236
|
# $ ruby optparse-test.rb --user 2
|
|
236
237
|
# #<struct User id=2, name="Gandalf">
|
|
237
238
|
# $ ruby optparse-test.rb --user 3
|
|
238
|
-
# optparse-test.rb:15:in
|
|
239
|
+
# optparse-test.rb:15:in 'block in find_user': No User Found for id 3 (RuntimeError)
|
|
239
240
|
#
|
|
240
241
|
# === Store options to a Hash
|
|
241
242
|
#
|
|
@@ -425,7 +426,8 @@
|
|
|
425
426
|
#
|
|
426
427
|
class OptionParser
|
|
427
428
|
# The version string
|
|
428
|
-
|
|
429
|
+
VERSION = "0.7.0"
|
|
430
|
+
Version = VERSION # for compatibility
|
|
429
431
|
|
|
430
432
|
# :stopdoc:
|
|
431
433
|
NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
|
|
@@ -461,6 +463,10 @@ class OptionParser
|
|
|
461
463
|
candidates
|
|
462
464
|
end
|
|
463
465
|
|
|
466
|
+
def self.completable?(key)
|
|
467
|
+
String.try_convert(key) or defined?(key.id2name)
|
|
468
|
+
end
|
|
469
|
+
|
|
464
470
|
def candidate(key, icase = false, pat = nil, &_)
|
|
465
471
|
Completion.candidate(key, icase, pat, &method(:each))
|
|
466
472
|
end
|
|
@@ -496,7 +502,6 @@ class OptionParser
|
|
|
496
502
|
end
|
|
497
503
|
end
|
|
498
504
|
|
|
499
|
-
|
|
500
505
|
#
|
|
501
506
|
# Map from option/keyword string to object with completion.
|
|
502
507
|
#
|
|
@@ -504,7 +509,6 @@ class OptionParser
|
|
|
504
509
|
include Completion
|
|
505
510
|
end
|
|
506
511
|
|
|
507
|
-
|
|
508
512
|
#
|
|
509
513
|
# Individual switch class. Not important to the user.
|
|
510
514
|
#
|
|
@@ -546,11 +550,11 @@ class OptionParser
|
|
|
546
550
|
|
|
547
551
|
def initialize(pattern = nil, conv = nil,
|
|
548
552
|
short = nil, long = nil, arg = nil,
|
|
549
|
-
desc = ([] if short or long), block = nil, &_block)
|
|
553
|
+
desc = ([] if short or long), block = nil, values = nil, &_block)
|
|
550
554
|
raise if Array === pattern
|
|
551
555
|
block ||= _block
|
|
552
|
-
@pattern, @conv, @short, @long, @arg, @desc, @block =
|
|
553
|
-
pattern, conv, short, long, arg, desc, block
|
|
556
|
+
@pattern, @conv, @short, @long, @arg, @desc, @block, @values =
|
|
557
|
+
pattern, conv, short, long, arg, desc, block, values
|
|
554
558
|
end
|
|
555
559
|
|
|
556
560
|
#
|
|
@@ -583,11 +587,15 @@ class OptionParser
|
|
|
583
587
|
# exception.
|
|
584
588
|
#
|
|
585
589
|
def conv_arg(arg, val = []) # :nodoc:
|
|
590
|
+
v, = *val
|
|
586
591
|
if conv
|
|
587
592
|
val = conv.call(*val)
|
|
588
593
|
else
|
|
589
594
|
val = proc {|v| v}.call(*val)
|
|
590
595
|
end
|
|
596
|
+
if @values
|
|
597
|
+
@values.include?(val) or raise InvalidArgument, v
|
|
598
|
+
end
|
|
591
599
|
return arg, block, val
|
|
592
600
|
end
|
|
593
601
|
private :conv_arg
|
|
@@ -668,7 +676,7 @@ class OptionParser
|
|
|
668
676
|
|
|
669
677
|
(sopts+lopts).each do |opt|
|
|
670
678
|
# "(-x -c -r)-l[left justify]"
|
|
671
|
-
if
|
|
679
|
+
if /\A--\[no-\](.+)$/ =~ opt
|
|
672
680
|
o = $1
|
|
673
681
|
yield("--#{o}", desc.join(""))
|
|
674
682
|
yield("--no-#{o}", desc.join(""))
|
|
@@ -1032,7 +1040,6 @@ class OptionParser
|
|
|
1032
1040
|
DefaultList.short['-'] = Switch::NoArgument.new {}
|
|
1033
1041
|
DefaultList.long[''] = Switch::NoArgument.new {throw :terminate}
|
|
1034
1042
|
|
|
1035
|
-
|
|
1036
1043
|
COMPSYS_HEADER = <<'XXX' # :nodoc:
|
|
1037
1044
|
|
|
1038
1045
|
typeset -A opt_args
|
|
@@ -1051,16 +1058,16 @@ XXX
|
|
|
1051
1058
|
end
|
|
1052
1059
|
|
|
1053
1060
|
def help_exit
|
|
1054
|
-
if
|
|
1061
|
+
if $stdout.tty? && (pager = ENV.values_at(*%w[RUBY_PAGER PAGER]).find {|e| e && !e.empty?})
|
|
1055
1062
|
less = ENV["LESS"]
|
|
1056
|
-
args = [{"LESS" => "#{
|
|
1063
|
+
args = [{"LESS" => "#{less} -Fe"}, pager, "w"]
|
|
1057
1064
|
print = proc do |f|
|
|
1058
1065
|
f.puts help
|
|
1059
1066
|
rescue Errno::EPIPE
|
|
1060
1067
|
# pager terminated
|
|
1061
1068
|
end
|
|
1062
1069
|
if Process.respond_to?(:fork) and false
|
|
1063
|
-
IO.popen("-") {|f| f ? Process.exec(*args, in: f) : print.call(
|
|
1070
|
+
IO.popen("-") {|f| f ? Process.exec(*args, in: f) : print.call($stdout)}
|
|
1064
1071
|
# unreachable
|
|
1065
1072
|
end
|
|
1066
1073
|
IO.popen(*args, &print)
|
|
@@ -1102,7 +1109,7 @@ XXX
|
|
|
1102
1109
|
#
|
|
1103
1110
|
Officious['*-completion-zsh'] = proc do |parser|
|
|
1104
1111
|
Switch::OptionalArgument.new do |arg|
|
|
1105
|
-
parser.compsys(
|
|
1112
|
+
parser.compsys($stdout, arg)
|
|
1106
1113
|
exit
|
|
1107
1114
|
end
|
|
1108
1115
|
end
|
|
@@ -1115,7 +1122,7 @@ XXX
|
|
|
1115
1122
|
Switch::OptionalArgument.new do |pkg|
|
|
1116
1123
|
if pkg
|
|
1117
1124
|
begin
|
|
1118
|
-
|
|
1125
|
+
require_relative 'optparse/version'
|
|
1119
1126
|
rescue LoadError
|
|
1120
1127
|
else
|
|
1121
1128
|
show_version(*pkg.split(/,/)) or
|
|
@@ -1288,7 +1295,15 @@ XXX
|
|
|
1288
1295
|
# to $0.
|
|
1289
1296
|
#
|
|
1290
1297
|
def program_name
|
|
1291
|
-
@program_name || File.basename($0
|
|
1298
|
+
@program_name || strip_ext(File.basename($0))
|
|
1299
|
+
end
|
|
1300
|
+
|
|
1301
|
+
private def strip_ext(name) # :nodoc:
|
|
1302
|
+
exts = /#{
|
|
1303
|
+
require "rbconfig"
|
|
1304
|
+
Regexp.union(*RbConfig::CONFIG["EXECUTABLE_EXTS"]&.split(" "))
|
|
1305
|
+
}\z/o
|
|
1306
|
+
name.sub(exts, "")
|
|
1292
1307
|
end
|
|
1293
1308
|
|
|
1294
1309
|
# for experimental cascading :-)
|
|
@@ -1467,6 +1482,7 @@ XXX
|
|
|
1467
1482
|
klass = nil
|
|
1468
1483
|
q, a = nil
|
|
1469
1484
|
has_arg = false
|
|
1485
|
+
values = nil
|
|
1470
1486
|
|
|
1471
1487
|
opts.each do |o|
|
|
1472
1488
|
# argument class
|
|
@@ -1480,7 +1496,7 @@ XXX
|
|
|
1480
1496
|
end
|
|
1481
1497
|
|
|
1482
1498
|
# directly specified pattern(any object possible to match)
|
|
1483
|
-
if
|
|
1499
|
+
if !Completion.completable?(o) and o.respond_to?(:match)
|
|
1484
1500
|
pattern = notwice(o, pattern, 'pattern')
|
|
1485
1501
|
if pattern.respond_to?(:convert)
|
|
1486
1502
|
conv = pattern.method(:convert).to_proc
|
|
@@ -1494,7 +1510,12 @@ XXX
|
|
|
1494
1510
|
case o
|
|
1495
1511
|
when Proc, Method
|
|
1496
1512
|
block = notwice(o, block, 'block')
|
|
1497
|
-
when Array, Hash
|
|
1513
|
+
when Array, Hash, Set
|
|
1514
|
+
if Array === o
|
|
1515
|
+
o, v = o.partition {|v,| Completion.completable?(v)}
|
|
1516
|
+
values = notwice(v, values, 'values') unless v.empty?
|
|
1517
|
+
next if o.empty?
|
|
1518
|
+
end
|
|
1498
1519
|
case pattern
|
|
1499
1520
|
when CompletingHash
|
|
1500
1521
|
when nil
|
|
@@ -1504,11 +1525,13 @@ XXX
|
|
|
1504
1525
|
raise ArgumentError, "argument pattern given twice"
|
|
1505
1526
|
end
|
|
1506
1527
|
o.each {|pat, *v| pattern[pat] = v.fetch(0) {pat}}
|
|
1528
|
+
when Range
|
|
1529
|
+
values = notwice(o, values, 'values')
|
|
1507
1530
|
when Module
|
|
1508
1531
|
raise ArgumentError, "unsupported argument type: #{o}", ParseError.filter_backtrace(caller(4))
|
|
1509
1532
|
when *ArgumentStyle.keys
|
|
1510
1533
|
style = notwice(ArgumentStyle[o], style, 'style')
|
|
1511
|
-
when
|
|
1534
|
+
when /\A--no-([^\[\]=\s]*)(.+)?/
|
|
1512
1535
|
q, a = $1, $2
|
|
1513
1536
|
o = notwice(a ? Object : TrueClass, klass, 'type')
|
|
1514
1537
|
not_pattern, not_conv = search(:atype, o) unless not_style
|
|
@@ -1519,7 +1542,7 @@ XXX
|
|
|
1519
1542
|
(q = q.downcase).tr!('_', '-')
|
|
1520
1543
|
long << "no-#{q}"
|
|
1521
1544
|
nolong << q
|
|
1522
|
-
when
|
|
1545
|
+
when /\A--\[no-\]([^\[\]=\s]*)(.+)?/
|
|
1523
1546
|
q, a = $1, $2
|
|
1524
1547
|
o = notwice(a ? Object : TrueClass, klass, 'type')
|
|
1525
1548
|
if a
|
|
@@ -1532,7 +1555,7 @@ XXX
|
|
|
1532
1555
|
not_pattern, not_conv = search(:atype, FalseClass) unless not_style
|
|
1533
1556
|
not_style = Switch::NoArgument
|
|
1534
1557
|
nolong << "no-#{o}"
|
|
1535
|
-
when
|
|
1558
|
+
when /\A--([^\[\]=\s]*)(.+)?/
|
|
1536
1559
|
q, a = $1, $2
|
|
1537
1560
|
if a
|
|
1538
1561
|
o = notwice(NilClass, klass, 'type')
|
|
@@ -1542,7 +1565,7 @@ XXX
|
|
|
1542
1565
|
ldesc << "--#{q}"
|
|
1543
1566
|
(o = q.downcase).tr!('_', '-')
|
|
1544
1567
|
long << o
|
|
1545
|
-
when
|
|
1568
|
+
when /\A-(\[\^?\]?(?:[^\\\]]|\\.)*\])(.+)?/
|
|
1546
1569
|
q, a = $1, $2
|
|
1547
1570
|
o = notwice(Object, klass, 'type')
|
|
1548
1571
|
if a
|
|
@@ -1553,7 +1576,7 @@ XXX
|
|
|
1553
1576
|
end
|
|
1554
1577
|
sdesc << "-#{q}"
|
|
1555
1578
|
short << Regexp.new(q)
|
|
1556
|
-
when
|
|
1579
|
+
when /\A-(.)(.+)?/
|
|
1557
1580
|
q, a = $1, $2
|
|
1558
1581
|
if a
|
|
1559
1582
|
o = notwice(NilClass, klass, 'type')
|
|
@@ -1562,7 +1585,7 @@ XXX
|
|
|
1562
1585
|
end
|
|
1563
1586
|
sdesc << "-#{q}"
|
|
1564
1587
|
short << q
|
|
1565
|
-
when
|
|
1588
|
+
when /\A=/
|
|
1566
1589
|
style = notwice(default_style.guess(arg = o), style, 'style')
|
|
1567
1590
|
default_pattern, conv = search(:atype, Object) unless default_pattern
|
|
1568
1591
|
else
|
|
@@ -1571,12 +1594,18 @@ XXX
|
|
|
1571
1594
|
end
|
|
1572
1595
|
|
|
1573
1596
|
default_pattern, conv = search(:atype, default_style.pattern) unless default_pattern
|
|
1597
|
+
if Range === values and klass
|
|
1598
|
+
unless (!values.begin or klass === values.begin) and
|
|
1599
|
+
(!values.end or klass === values.end)
|
|
1600
|
+
raise ArgumentError, "range does not match class"
|
|
1601
|
+
end
|
|
1602
|
+
end
|
|
1574
1603
|
if !(short.empty? and long.empty?)
|
|
1575
1604
|
if has_arg and default_style == Switch::NoArgument
|
|
1576
1605
|
default_style = Switch::RequiredArgument
|
|
1577
1606
|
end
|
|
1578
1607
|
s = (style || default_style).new(pattern || default_pattern,
|
|
1579
|
-
conv, sdesc, ldesc, arg, desc, block)
|
|
1608
|
+
conv, sdesc, ldesc, arg, desc, block, values)
|
|
1580
1609
|
elsif !block
|
|
1581
1610
|
if style or pattern
|
|
1582
1611
|
raise ArgumentError, "no switch given", ParseError.filter_backtrace(caller)
|
|
@@ -1585,7 +1614,7 @@ XXX
|
|
|
1585
1614
|
else
|
|
1586
1615
|
short << pattern
|
|
1587
1616
|
s = (style || default_style).new(pattern,
|
|
1588
|
-
conv, nil, nil, arg, desc, block)
|
|
1617
|
+
conv, nil, nil, arg, desc, block, values)
|
|
1589
1618
|
end
|
|
1590
1619
|
return s, short, long,
|
|
1591
1620
|
(not_style.new(not_pattern, not_conv, sdesc, ldesc, nil, desc, block) if not_style),
|
|
@@ -1729,9 +1758,9 @@ XXX
|
|
|
1729
1758
|
end
|
|
1730
1759
|
end
|
|
1731
1760
|
begin
|
|
1732
|
-
opt, cb,
|
|
1733
|
-
val = callback!(cb, 1,
|
|
1734
|
-
callback!(setter, 2, sw.switch_name,
|
|
1761
|
+
opt, cb, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
|
|
1762
|
+
val = callback!(cb, 1, val) if cb
|
|
1763
|
+
callback!(setter, 2, sw.switch_name, val) if setter
|
|
1735
1764
|
rescue ParseError
|
|
1736
1765
|
raise $!.set_option(arg, rest)
|
|
1737
1766
|
end
|
|
@@ -1761,7 +1790,7 @@ XXX
|
|
|
1761
1790
|
raise $!.set_option(arg, true)
|
|
1762
1791
|
end
|
|
1763
1792
|
begin
|
|
1764
|
-
opt, cb,
|
|
1793
|
+
opt, cb, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
|
|
1765
1794
|
rescue ParseError
|
|
1766
1795
|
raise $!.set_option(arg, arg.length > 2)
|
|
1767
1796
|
else
|
|
@@ -1769,8 +1798,8 @@ XXX
|
|
|
1769
1798
|
end
|
|
1770
1799
|
begin
|
|
1771
1800
|
argv.unshift(opt) if opt and (!rest or (opt = opt.sub(/\A-*/, '-')) != '-')
|
|
1772
|
-
val = callback!(cb, 1,
|
|
1773
|
-
callback!(setter, 2, sw.switch_name,
|
|
1801
|
+
val = callback!(cb, 1, val) if cb
|
|
1802
|
+
callback!(setter, 2, sw.switch_name, val) if setter
|
|
1774
1803
|
rescue ParseError
|
|
1775
1804
|
raise $!.set_option(arg, arg.length > 2)
|
|
1776
1805
|
end
|
|
@@ -1798,6 +1827,8 @@ XXX
|
|
|
1798
1827
|
|
|
1799
1828
|
# Calls callback with _val_.
|
|
1800
1829
|
def callback!(cb, max_arity, *args) # :nodoc:
|
|
1830
|
+
args.compact!
|
|
1831
|
+
|
|
1801
1832
|
if (size = args.size) < max_arity and cb.to_proc.lambda?
|
|
1802
1833
|
(arity = cb.arity) < 0 and arity = (1-arity)
|
|
1803
1834
|
arity = max_arity if arity > max_arity
|
|
@@ -1825,7 +1856,7 @@ XXX
|
|
|
1825
1856
|
#
|
|
1826
1857
|
def permute!(argv = default_argv, **keywords)
|
|
1827
1858
|
nonopts = []
|
|
1828
|
-
order!(argv, **keywords
|
|
1859
|
+
order!(argv, **keywords) {|nonopt| nonopts << nonopt}
|
|
1829
1860
|
argv[0, 0] = nonopts
|
|
1830
1861
|
argv
|
|
1831
1862
|
end
|
|
@@ -1878,13 +1909,16 @@ XXX
|
|
|
1878
1909
|
single_options, *long_options = *args
|
|
1879
1910
|
|
|
1880
1911
|
result = {}
|
|
1912
|
+
setter = (symbolize_names ?
|
|
1913
|
+
->(name, val) {result[name.to_sym] = val}
|
|
1914
|
+
: ->(name, val) {result[name] = val})
|
|
1881
1915
|
|
|
1882
1916
|
single_options.scan(/(.)(:)?/) do |opt, val|
|
|
1883
1917
|
if val
|
|
1884
|
-
|
|
1918
|
+
setter[opt, nil]
|
|
1885
1919
|
define("-#{opt} VAL")
|
|
1886
1920
|
else
|
|
1887
|
-
|
|
1921
|
+
setter[opt, false]
|
|
1888
1922
|
define("-#{opt}")
|
|
1889
1923
|
end
|
|
1890
1924
|
end if single_options
|
|
@@ -1893,16 +1927,16 @@ XXX
|
|
|
1893
1927
|
arg, desc = arg.split(';', 2)
|
|
1894
1928
|
opt, val = arg.split(':', 2)
|
|
1895
1929
|
if val
|
|
1896
|
-
|
|
1930
|
+
setter[opt, (val unless val.empty?)]
|
|
1897
1931
|
define("--#{opt}=#{result[opt] || "VAL"}", *[desc].compact)
|
|
1898
1932
|
else
|
|
1899
|
-
|
|
1933
|
+
setter[opt, false]
|
|
1900
1934
|
define("--#{opt}", *[desc].compact)
|
|
1901
1935
|
end
|
|
1902
1936
|
end
|
|
1903
1937
|
|
|
1904
|
-
parse_in_order(argv,
|
|
1905
|
-
|
|
1938
|
+
parse_in_order(argv, setter, **keywords)
|
|
1939
|
+
result
|
|
1906
1940
|
end
|
|
1907
1941
|
|
|
1908
1942
|
#
|
|
@@ -1952,7 +1986,7 @@ XXX
|
|
|
1952
1986
|
visit(:complete, typ, opt, icase, *pat) {|o, *sw| return sw}
|
|
1953
1987
|
}
|
|
1954
1988
|
exc = ambiguous ? AmbiguousOption : InvalidOption
|
|
1955
|
-
raise exc.new(opt, additional:
|
|
1989
|
+
raise exc.new(opt, additional: proc {|o| additional_message(typ, o)})
|
|
1956
1990
|
end
|
|
1957
1991
|
private :complete
|
|
1958
1992
|
|
|
@@ -2017,19 +2051,27 @@ XXX
|
|
|
2017
2051
|
def load(filename = nil, **keywords)
|
|
2018
2052
|
unless filename
|
|
2019
2053
|
basename = File.basename($0, '.*')
|
|
2020
|
-
return true if load(File.expand_path(
|
|
2054
|
+
return true if load(File.expand_path("~/.options/#{basename}"), **keywords) rescue nil
|
|
2021
2055
|
basename << ".options"
|
|
2056
|
+
if !(xdg = ENV['XDG_CONFIG_HOME']) or xdg.empty?
|
|
2057
|
+
# https://specifications.freedesktop.org/basedir-spec/latest/#variables
|
|
2058
|
+
#
|
|
2059
|
+
# If $XDG_CONFIG_HOME is either not set or empty, a default
|
|
2060
|
+
# equal to $HOME/.config should be used.
|
|
2061
|
+
xdg = ['~/.config', true]
|
|
2062
|
+
end
|
|
2022
2063
|
return [
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
'~/.config',
|
|
2064
|
+
xdg,
|
|
2065
|
+
|
|
2026
2066
|
*ENV['XDG_CONFIG_DIRS']&.split(File::PATH_SEPARATOR),
|
|
2027
2067
|
|
|
2028
2068
|
# Haiku
|
|
2029
|
-
'~/config/settings',
|
|
2030
|
-
].any? {|dir|
|
|
2069
|
+
['~/config/settings', true],
|
|
2070
|
+
].any? {|dir, expand|
|
|
2031
2071
|
next if !dir or dir.empty?
|
|
2032
|
-
|
|
2072
|
+
filename = File.join(dir, basename)
|
|
2073
|
+
filename = File.expand_path(filename) if expand
|
|
2074
|
+
load(filename, **keywords) rescue nil
|
|
2033
2075
|
}
|
|
2034
2076
|
end
|
|
2035
2077
|
begin
|
|
@@ -2235,9 +2277,10 @@ XXX
|
|
|
2235
2277
|
argv
|
|
2236
2278
|
end
|
|
2237
2279
|
|
|
2280
|
+
DIR = File.join(__dir__, '')
|
|
2238
2281
|
def self.filter_backtrace(array)
|
|
2239
2282
|
unless $DEBUG
|
|
2240
|
-
array.delete_if
|
|
2283
|
+
array.delete_if {|bt| bt.start_with?(DIR)}
|
|
2241
2284
|
end
|
|
2242
2285
|
array
|
|
2243
2286
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: optparse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nobu Nakada
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2025-10-31 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
|
-
description:
|
|
12
|
+
description: |
|
|
13
|
+
OptionParser is a class for command-line option analysis. It is much more
|
|
14
|
+
advanced, yet also easier to use, than GetoptLong, and is a more Ruby-oriented
|
|
15
|
+
solution.
|
|
14
16
|
email:
|
|
15
17
|
- nobu@ruby-lang.org
|
|
16
18
|
executables: []
|
|
@@ -19,8 +21,8 @@ extra_rdoc_files: []
|
|
|
19
21
|
files:
|
|
20
22
|
- ".document"
|
|
21
23
|
- ".rdoc_options"
|
|
24
|
+
- BSDL
|
|
22
25
|
- COPYING
|
|
23
|
-
- ChangeLog
|
|
24
26
|
- README.md
|
|
25
27
|
- doc/optparse/.document
|
|
26
28
|
- doc/optparse/argument_converters.rdoc
|
|
@@ -101,11 +103,7 @@ licenses:
|
|
|
101
103
|
metadata:
|
|
102
104
|
homepage_uri: https://github.com/ruby/optparse
|
|
103
105
|
source_code_uri: https://github.com/ruby/optparse
|
|
104
|
-
|
|
105
|
-
rdoc_options:
|
|
106
|
-
- "--main=README.md"
|
|
107
|
-
- "--op=rdoc"
|
|
108
|
-
- "--page-dir=doc"
|
|
106
|
+
rdoc_options: []
|
|
109
107
|
require_paths:
|
|
110
108
|
- lib
|
|
111
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -119,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
119
117
|
- !ruby/object:Gem::Version
|
|
120
118
|
version: '0'
|
|
121
119
|
requirements: []
|
|
122
|
-
rubygems_version: 3.
|
|
123
|
-
signing_key:
|
|
120
|
+
rubygems_version: 3.6.9
|
|
124
121
|
specification_version: 4
|
|
125
122
|
summary: OptionParser is a class for command-line option analysis.
|
|
126
123
|
test_files: []
|
data/ChangeLog
DELETED
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
-*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
commit 979bd76281d28044b3def3eadba233a87e62415a
|
|
4
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
5
|
-
AuthorDate: 2024-04-15 18:42:47 +0900
|
|
6
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
7
|
-
CommitDate: 2024-04-15 18:42:47 +0900
|
|
8
|
-
|
|
9
|
-
[DOC] Split fetching commits and building package
|
|
10
|
-
|
|
11
|
-
commit ca883bd3a1ac13957774fcb93e8bccd80b74c9d1
|
|
12
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
13
|
-
AuthorDate: 2024-04-15 18:21:31 +0900
|
|
14
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
15
|
-
CommitDate: 2024-04-15 18:21:31 +0900
|
|
16
|
-
|
|
17
|
-
[DOC] git on Github Actions is old
|
|
18
|
-
|
|
19
|
-
It does not support `--unshallow-exclude` option.
|
|
20
|
-
|
|
21
|
-
commit 7f79bc820ff0e04a05204ec63c5fc3e9c85e14ad
|
|
22
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
23
|
-
AuthorDate: 2024-04-15 18:08:57 +0900
|
|
24
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
25
|
-
CommitDate: 2024-04-15 18:08:57 +0900
|
|
26
|
-
|
|
27
|
-
[DOC] Fix error when no tag found
|
|
28
|
-
|
|
29
|
-
commit add085df63d79d878a8901c42f2cfc3eec56307f
|
|
30
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
31
|
-
AuthorDate: 2024-04-15 15:57:09 +0900
|
|
32
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
33
|
-
CommitDate: 2024-04-15 15:58:54 +0900
|
|
34
|
-
|
|
35
|
-
Fetch upto the previous tag for changelogs
|
|
36
|
-
|
|
37
|
-
commit 436a5c516b67f8aec900f2361567c6fc163ade05
|
|
38
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
39
|
-
AuthorDate: 2024-04-15 15:08:19 +0900
|
|
40
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
41
|
-
CommitDate: 2024-04-15 15:08:19 +0900
|
|
42
|
-
|
|
43
|
-
[DOC] Make timestamps in a ISO 8601-like format
|
|
44
|
-
|
|
45
|
-
commit 3a2dcd72d1fdabf63218cd13c8c7953cb3c28f6b
|
|
46
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
47
|
-
AuthorDate: 2024-04-15 14:55:14 +0900
|
|
48
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
49
|
-
CommitDate: 2024-04-15 14:55:14 +0900
|
|
50
|
-
|
|
51
|
-
[DOC] Make ChangeLog non-empty
|
|
52
|
-
|
|
53
|
-
When the latest version is tagged at the head, there is no commit
|
|
54
|
-
between the tag and the head. Make from the previous tag.
|
|
55
|
-
|
|
56
|
-
commit b7382c02f1092f2c0ef0f4096d3b8428e2adf3fa
|
|
57
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
58
|
-
AuthorDate: 2024-04-15 14:49:59 +0900
|
|
59
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
60
|
-
CommitDate: 2024-04-15 14:49:59 +0900
|
|
61
|
-
|
|
62
|
-
[DOC] Exclude CI-skipped commits from changelogs
|
|
63
|
-
|
|
64
|
-
commit b49cb996afdd68e4eb373ba602c95b52c963d160
|
|
65
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
66
|
-
AuthorDate: 2024-04-15 14:24:19 +0900
|
|
67
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
68
|
-
CommitDate: 2024-04-15 14:24:19 +0900
|
|
69
|
-
|
|
70
|
-
[DOC] Package files for RDoc
|
|
71
|
-
|
|
72
|
-
commit f5018a8b1ce82f7ac7458d00d099a454c3c03ea1
|
|
73
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
74
|
-
AuthorDate: 2024-04-15 14:05:43 +0900
|
|
75
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
76
|
-
CommitDate: 2024-04-15 14:05:43 +0900
|
|
77
|
-
|
|
78
|
-
bump up to 0.5.0
|
|
79
|
-
|
|
80
|
-
commit ece4bb2673c7fa9f53133ba91bbffd423ebadc90
|
|
81
|
-
Author: Koichi Sasada <ko1@atdot.net>
|
|
82
|
-
AuthorDate: 2024-03-27 07:29:38 +0900
|
|
83
|
-
Commit: Koichi Sasada <ko1@atdot.net>
|
|
84
|
-
CommitDate: 2024-04-15 12:08:07 +0900
|
|
85
|
-
|
|
86
|
-
show warning for unused block
|
|
87
|
-
|
|
88
|
-
With verbopse mode (-w), the interpreter shows a warning if
|
|
89
|
-
a block is passed to a method which does not use the given block.
|
|
90
|
-
|
|
91
|
-
Warning on:
|
|
92
|
-
|
|
93
|
-
* the invoked method is not written in C
|
|
94
|
-
* the invoked method is not `initialize`
|
|
95
|
-
* not invoked with `super`
|
|
96
|
-
* the first time on the call-site with the invoked method
|
|
97
|
-
(`obj.foo{}` will be warned once if `foo` is same method)
|
|
98
|
-
|
|
99
|
-
[Feature #15554]
|
|
100
|
-
|
|
101
|
-
`Primitive.attr! :use_block` is introduced to declare that primitive
|
|
102
|
-
functions (written in C) will use passed block.
|
|
103
|
-
|
|
104
|
-
For minitest, test needs some tweak, so use
|
|
105
|
-
https://github.com/minitest/minitest/commit/ea9caafc0754b1d6236a490d59e624b53209734a
|
|
106
|
-
for `test-bundled-gems`.
|
|
107
|
-
|
|
108
|
-
ruby/ruby@9180e33ca3a5886fec3f9e0a2f48072b55914e65
|
|
109
|
-
|
|
110
|
-
commit 77dccce37cb9fd1b8fbc52160d4103d1c4579669
|
|
111
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
112
|
-
AuthorDate: 2024-03-01 01:24:05 +0900
|
|
113
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
114
|
-
CommitDate: 2024-03-01 01:24:05 +0900
|
|
115
|
-
|
|
116
|
-
Invoke pager for `--help`
|
|
117
|
-
|
|
118
|
-
commit 59b9fd7ddca3e795c235aa397655b51de2e4c949
|
|
119
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
120
|
-
AuthorDate: 2024-02-23 21:49:57 +0900
|
|
121
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
122
|
-
CommitDate: 2024-02-23 21:49:57 +0900
|
|
123
|
-
|
|
124
|
-
[DOC] About return value of OptionParser#new
|
|
125
|
-
|
|
126
|
-
commit 07e83673a8e99b5b7985608a69f713abde3344f6
|
|
127
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
128
|
-
AuthorDate: 2024-02-21 13:42:11 +0900
|
|
129
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
130
|
-
CommitDate: 2024-02-23 21:13:51 +0900
|
|
131
|
-
|
|
132
|
-
Add `exact:` keyword argument
|
|
133
|
-
|
|
134
|
-
commit bbec64d0c7f198429b62468b64b27692efa18dc2
|
|
135
|
-
Author: Yusuke Endoh <mame@ruby-lang.org>
|
|
136
|
-
AuthorDate: 2024-01-19 16:03:38 +0900
|
|
137
|
-
Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
|
|
138
|
-
CommitDate: 2024-02-16 10:47:36 +0900
|
|
139
|
-
|
|
140
|
-
Do not include a backtick in error messages and backtraces
|
|
141
|
-
|
|
142
|
-
[Feature #16495]
|
|
143
|
-
|
|
144
|
-
commit 451dea51a0e5d062fb4cb75b1073a2c2b8609bef
|
|
145
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
146
|
-
AuthorDate: 2024-02-12 01:30:58 +0900
|
|
147
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
148
|
-
CommitDate: 2024-02-12 01:30:58 +0900
|
|
149
|
-
|
|
150
|
-
[DOC] Add description of OptionParser#define_by_keywords
|
|
151
|
-
|
|
152
|
-
commit 33956ce93f56320978cedfcebb8b6cf18bf96c53
|
|
153
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
154
|
-
AuthorDate: 2024-02-12 01:07:05 +0900
|
|
155
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
156
|
-
CommitDate: 2024-02-12 01:07:05 +0900
|
|
157
|
-
|
|
158
|
-
[DOC] Add missing documents
|
|
159
|
-
|
|
160
|
-
commit 78afdab30751e1b7cf80bb57d6696b10879f90fe
|
|
161
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
162
|
-
AuthorDate: 2024-02-10 22:56:32 +0900
|
|
163
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
164
|
-
CommitDate: 2024-02-10 22:56:32 +0900
|
|
165
|
-
|
|
166
|
-
Search exactly when `require_exact`
|
|
167
|
-
|
|
168
|
-
To work with options defined as `--[no]-something`.
|
|
169
|
-
|
|
170
|
-
Fix https://bugs.ruby-lang.org/issues/20252
|
|
171
|
-
Fix #60
|
|
172
|
-
|
|
173
|
-
commit 213cb03b5978ddacfbcc8f71ec837d9a6fd4c56d
|
|
174
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
175
|
-
AuthorDate: 2024-02-09 19:03:20 +0900
|
|
176
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
177
|
-
CommitDate: 2024-02-09 19:03:20 +0900
|
|
178
|
-
|
|
179
|
-
Adjust arguments for lambda-callbacks
|
|
180
|
-
|
|
181
|
-
Rake uses [lambda] as callbacks.
|
|
182
|
-
Calling it without omitted argument raises an `ArgumentError`.
|
|
183
|
-
|
|
184
|
-
lambda: https://github.com/ruby/rake/blob/master/lib/rake/application.rb#L543
|
|
185
|
-
|
|
186
|
-
commit 9d53e74aa4421e0c4e2a805a0074ece5aae3773f
|
|
187
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
188
|
-
AuthorDate: 2024-02-09 12:59:43 +0900
|
|
189
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
190
|
-
CommitDate: 2024-02-09 12:59:43 +0900
|
|
191
|
-
|
|
192
|
-
Respect default values in block parameters
|
|
193
|
-
|
|
194
|
-
Fix #55
|
|
195
|
-
|
|
196
|
-
commit 4e346ad337f400dbff855798e859f17455698c2a
|
|
197
|
-
Author: fatkodima <fatkodima123@gmail.com>
|
|
198
|
-
AuthorDate: 2023-10-14 21:52:01 +0300
|
|
199
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
200
|
-
CommitDate: 2024-02-09 12:31:08 +0900
|
|
201
|
-
|
|
202
|
-
Fix `require_exact` to work with options defined as `--[no]-something`
|
|
203
|
-
|
|
204
|
-
commit b14c2c644d18cce226e49ccde8a23b5b991ea8cf
|
|
205
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
206
|
-
AuthorDate: 2024-02-09 12:17:31 +0900
|
|
207
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
208
|
-
CommitDate: 2024-02-09 12:17:31 +0900
|
|
209
|
-
|
|
210
|
-
Escape backslashes
|
|
211
|
-
|
|
212
|
-
commit 434e92fc62ff9571124335a2eedff56df83dae48
|
|
213
|
-
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
|
|
214
|
-
AuthorDate: 2023-12-18 03:43:27 +0000
|
|
215
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
216
|
-
CommitDate: 2024-02-09 12:14:30 +0900
|
|
217
|
-
|
|
218
|
-
Bump actions/upload-artifact from 3 to 4
|
|
219
|
-
|
|
220
|
-
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
|
|
221
|
-
- [Release notes](https://github.com/actions/upload-artifact/releases)
|
|
222
|
-
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
updated-dependencies:
|
|
226
|
-
- dependency-name: actions/upload-artifact
|
|
227
|
-
dependency-type: direct:production
|
|
228
|
-
update-type: version-update:semver-major
|
|
229
|
-
...
|
|
230
|
-
|
|
231
|
-
Signed-off-by: dependabot[bot] <support@github.com>
|
|
232
|
-
|
|
233
|
-
commit 48385d3eaf37cd10140274453eeadc4496581fc2
|
|
234
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
235
|
-
AuthorDate: 2024-02-09 12:01:44 +0900
|
|
236
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
237
|
-
CommitDate: 2024-02-09 12:06:40 +0900
|
|
238
|
-
|
|
239
|
-
Create codeql.yml
|
|
240
|
-
|
|
241
|
-
commit 294c6e1ed4b170a8a34ab95c84453829c170223c
|
|
242
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
243
|
-
AuthorDate: 2023-12-25 15:08:05 +0900
|
|
244
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
245
|
-
CommitDate: 2023-12-25 15:08:05 +0900
|
|
246
|
-
|
|
247
|
-
Build packages only on the latest release
|
|
248
|
-
|
|
249
|
-
commit 324ff21f042769444cde41949fc0321f6c6ccf63
|
|
250
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
251
|
-
AuthorDate: 2023-12-18 12:45:44 +0900
|
|
252
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
253
|
-
CommitDate: 2023-12-18 12:45:44 +0900
|
|
254
|
-
|
|
255
|
-
[DOC] Add missing documents
|
|
256
|
-
|
|
257
|
-
commit 667ab35f593f81b7850009385453d20ca8023bba
|
|
258
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
259
|
-
AuthorDate: 2023-12-18 12:24:46 +0900
|
|
260
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
261
|
-
CommitDate: 2023-12-18 12:24:46 +0900
|
|
262
|
-
|
|
263
|
-
[DOC] Add missing secition
|
|
264
|
-
|
|
265
|
-
Fixes #51
|
|
266
|
-
|
|
267
|
-
commit 1c895efc39ed2290c185dcb80523fee381dfe74e
|
|
268
|
-
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
269
|
-
AuthorDate: 2023-12-18 12:15:31 +0900
|
|
270
|
-
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
271
|
-
CommitDate: 2023-12-18 12:15:31 +0900
|
|
272
|
-
|
|
273
|
-
[DOC] Fix tutorial link
|
|
274
|
-
|
|
275
|
-
Fixes #51
|