optparse 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 418e5857a7b44f43280185c3b47044dfeeae912cdfbb1732e1d449959d2f7ea6
4
- data.tar.gz: 7bc504678e83873db67b7a70cbf70a9795e6d5c8910ad7829ecc0f161eb09e91
3
+ metadata.gz: 393ddfd5f19439c98112418ff879314c8570d9955e4a26a148b6d3bd94354cda
4
+ data.tar.gz: 270b3538983dfd6920cae9b2fcda5d7dcb5304157ae1e323a0d56daf33a6dd60
5
5
  SHA512:
6
- metadata.gz: 5145d4416caf4eb5a64cf415548d56ae7b533089d29b83bd16876fdbde1c644f4b260e1aa3a68010d92107e065f9197c2e0e8691997d80261c5542bbc95ff6ef
7
- data.tar.gz: 37cb54b326baa9239ed1366ff2ad465352b8de03a32360f2a4d49e9214a1d6bb01916ebff354787ec378b7d7deb50b2444a1e45eac215fa335b21156ba594818
6
+ metadata.gz: 80e82b866fccf4b8598d3b495941629255ddfa907a8686a092d9ab5135d145d1c0a83d9d3d42ededcf1d33e21bc5ea6bfbee79f40085140e29a4ac54e6b96a1d
7
+ data.tar.gz: 998881fc6568b9725d7874145111cdee53e2366050a63f0e5908395f183d080eda16bf6740e8d83f90fe60064cf85fb424c24cd70e4589b344ee9dc3b997d283
data/ChangeLog CHANGED
@@ -1,277 +1,163 @@
1
1
  -*- coding: utf-8 -*-
2
2
 
3
- commit c80dfb1ebd9e92142de4a0719f7fb91d753c35e5
3
+ commit acbf6e3e12de4d116f7215b64432f204d293da97
4
4
  Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
5
- AuthorDate: 2022-12-05 16:17:01 +0900
5
+ AuthorDate: 2023-11-07 10:40:38 +0900
6
6
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
7
- CommitDate: 2022-12-05 16:17:01 +0900
7
+ CommitDate: 2023-11-07 10:40:38 +0900
8
8
 
9
- Bump version to 0.3.0
9
+ Bump up 0.4.0
10
10
 
11
- commit fee86ef7a443e602e951ac67143a890a22e8aa3a
12
- Author: Yusuke Endoh <mame@ruby-lang.org>
13
- AuthorDate: 2022-11-29 01:14:47 +0900
14
- Commit: Yusuke Endoh <mame@ruby-lang.org>
15
- CommitDate: 2022-11-29 01:14:47 +0900
16
-
17
- Fix the test failure i ruby/ruby
11
+ commit 38848ce4b31977d4a892c2a5573b304c77208283
12
+ Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
13
+ AuthorDate: 2023-10-05 16:17:40 +0900
14
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
15
+ CommitDate: 2023-10-05 16:26:53 +0900
18
16
 
19
- ```
20
- $ make test-all TESTS=test/optparse/
21
- ...
17
+ Use test-unit-ruby-core gem
22
18
 
23
- [148/178] TestOptionParserDidYouMean#test_raise_unknown = 0.00 s
24
- 1) Failure:
25
- TestOptionParserDidYouMean#test_raise_unknown [/home/mame/work/ruby/test/optparse/test_optparse.rb:106]:
26
- <["--bar"]> expected but was
27
- <[]>.
28
- ```
19
+ commit a291ef5c26445d423bf0223b0cb64340df18f0cb
20
+ Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
21
+ AuthorDate: 2023-09-11 03:20:53 +0000
22
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
23
+ CommitDate: 2023-09-11 14:02:17 +0900
29
24
 
30
- In the old test/unit (bundled in ruby/ruby), when a test class inherits from
31
- another test class, the child class runs all the tests defined in the parent
32
- class.
33
- However, it looks like the new test/unit does not do so. This is because the
34
- test failure does not occur in ruby/optparse.
25
+ Bump actions/checkout from 3 to 4
35
26
 
36
- As a tentative solution, this changes the option names in TestOptionParser to
37
- avoid the name conflict with TestOptionParserDidYouMean.
27
+ Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
28
+ - [Release notes](https://github.com/actions/checkout/releases)
29
+ - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
30
+ - [Commits](https://github.com/actions/checkout/compare/v3...v4)
38
31
 
39
- commit 12529653cd35ed38cb0a00d22ec0fe6e0907ce89
40
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
41
- AuthorDate: 2022-10-30 00:36:19 +0900
42
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
43
- CommitDate: 2022-11-28 23:23:54 +0900
32
+ ---
33
+ updated-dependencies:
34
+ - dependency-name: actions/checkout
35
+ dependency-type: direct:production
36
+ update-type: version-update:semver-major
37
+ ...
44
38
 
45
- Add `raise_unknown` flag (#38)
39
+ Signed-off-by: dependabot[bot] <support@github.com>
46
40
 
47
- commit ab5073e4d8928814a1e667bb93164d6998bf2558
48
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
49
- AuthorDate: 2022-11-21 18:28:33 +0900
50
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
51
- CommitDate: 2022-11-21 18:30:01 +0900
41
+ commit 2940dbb65a7df013995934a93e6906109adda766
42
+ Author: BurdetteLamar <burdettelamar@yahoo.com>
43
+ AuthorDate: 2023-07-30 16:35:00 +0100
44
+ Commit: BurdetteLamar <burdettelamar@yahoo.com>
45
+ CommitDate: 2023-07-30 16:35:00 +0100
52
46
 
53
- Use class methods of `File` over `IO`
47
+ [DOC] Corrections to tutorial
54
48
 
55
- commit 51f7e060ee6e2ccab6b052e7fb14532bc3485ce2
49
+ commit e8bee0be8f52f5a3e08d0db09a13798701670391
56
50
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
57
- AuthorDate: 2022-10-29 22:25:42 +0900
51
+ AuthorDate: 2023-07-30 11:24:59 +0900
58
52
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
59
- CommitDate: 2022-10-29 22:46:59 +0900
60
-
61
- Add tests for `load(into:)`
62
-
63
- commit 2ea626fcff72b68b5ae6e1381c28f5db94de7e94
64
- Author: Whyme Lyu <5longluna@gmail.com>
65
- AuthorDate: 2022-10-29 21:46:23 +0800
66
- Commit: GitHub <noreply@github.com>
67
- CommitDate: 2022-10-29 22:46:23 +0900
53
+ CommitDate: 2023-07-30 11:24:59 +0900
68
54
 
69
- #load() into hash (#42)
55
+ [DOC] Mark up constant and method names as code
70
56
 
71
- OptionParser#load learns .load(into: Hash)
72
-
73
- Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
74
-
75
- commit fb34a1d3a36aa33a5d2a02d511fbd705887505b0
57
+ commit 3cde2178d3d1bd1c7bf9c7e2af930e89e0bad6e5
76
58
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
77
- AuthorDate: 2022-10-29 22:23:14 +0900
59
+ AuthorDate: 2023-07-12 01:07:11 +0900
78
60
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
79
- CommitDate: 2022-10-29 22:40:11 +0900
80
-
81
- Add tests for `OptionParser#load`
61
+ CommitDate: 2023-07-12 01:07:37 +0900
82
62
 
83
- commit 078638ee6da875680ebcfd06efa50bb573fd1af2
84
- Author: Maciek Rząsa <maciejrzasa@gmail.com>
85
- AuthorDate: 2022-10-08 12:30:12 +0200
86
- Commit: GitHub <noreply@github.com>
87
- CommitDate: 2022-10-08 19:30:12 +0900
88
-
89
- Don't treat empty string as an option description
63
+ Upload according to build results
90
64
 
91
- commit 3bcca8a81574aaef19a6ba09f91fc1e318aadfa4
92
- Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
93
- AuthorDate: 2022-06-17 18:35:47 +0900
65
+ commit fb91d97c109269aee4fb0f7ecc1b3826dad118d8
66
+ Author: Jeremy Evans <code@jeremyevans.net>
67
+ AuthorDate: 2023-04-04 13:58:59 -0700
94
68
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
95
- CommitDate: 2022-06-17 18:41:16 +0900
96
-
97
- Update Ruby versions on GHA with ci_versions/all.json
69
+ CommitDate: 2023-04-05 08:43:45 +0900
98
70
 
99
- commit f2b8318631d3d265131a0b281ee730025eda9027
100
- Author: konsolebox <konsolebox@gmail.com>
101
- AuthorDate: 2022-06-09 19:43:24 +0800
102
- Commit: GitHub <noreply@github.com>
103
- CommitDate: 2022-06-09 20:43:24 +0900
71
+ Document requires needed for Date/DateTime/Time/URI/Shellwords support
104
72
 
105
- Also accept '-' as an optional argument (#35)
73
+ Fixes [Bug #19566]
106
74
 
107
- commit e70e689deddb6c1d72e2073a5c4723b3fdfff68c
108
- Author: ydah <13041216+ydah@users.noreply.github.com>
109
- AuthorDate: 2022-05-21 06:24:41 +0900
75
+ commit 5bf4fa8a72a00d0891106af21655800db1d2ceff
76
+ Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
77
+ AuthorDate: 2023-03-24 13:01:25 +0900
110
78
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
111
- CommitDate: 2022-05-21 08:47:36 +0900
112
-
113
- Fix typo in documentation
79
+ CommitDate: 2023-03-24 13:38:04 +0900
114
80
 
115
- - "hypnen" -> "hyphen"
116
- - "hadler" -> "handler"
81
+ Update test libraries from https://github.com/ruby/ruby/commit/b4e438d8aabaf4bba2b27f374c787543fae07c58
117
82
 
118
- commit 4b47d9c24b3b143bc661c3ef5d0de9f71882b4ce
119
- Author: Jeremy Evans <code@jeremyevans.net>
120
- AuthorDate: 2022-04-22 13:01:43 -0700
83
+ commit b67cc2407e6f9b5b4c9bc0751e21fa4969da0ceb
84
+ Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
85
+ AuthorDate: 2023-02-18 16:37:54 +0900
121
86
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
122
- CommitDate: 2022-05-02 20:12:12 +0900
123
-
124
- Avoid defining the same test class in multiple files
87
+ CommitDate: 2023-02-18 16:46:18 +0900
125
88
 
126
- Should fix issues with parallel testing sometimes not running all
127
- tests.
89
+ Skip build and upload package with Windows
128
90
 
129
- This should be viewed skipping whitespace changes.
130
-
131
- Fixes [Bug #18731]
132
-
133
- commit 2bea3b38c354c3a49b5705f9f560eef522b4b1e2
134
- Author: Peter Zhu <peter@peterzhu.ca>
135
- AuthorDate: 2022-04-14 11:15:57 -0400
91
+ commit fd6621a23da2e8d3d1a3ab75003dbfeb0e42e2ab
92
+ Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
93
+ AuthorDate: 2023-02-18 16:31:55 +0900
136
94
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
137
- CommitDate: 2022-04-15 14:21:13 +0900
95
+ CommitDate: 2023-02-18 16:46:18 +0900
138
96
 
139
- Fix broken links in docs
97
+ Exclude JRuby from Windows
140
98
 
141
- commit 3653d5b909d876d3322546a4c2157ea5a94df1b9
142
- Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
143
- AuthorDate: 2022-04-11 03:21:22 +0000
99
+ commit 426726fa170ab5a1ddba4f2ef04ae6864ed2a625
100
+ Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
101
+ AuthorDate: 2023-02-18 16:25:39 +0900
144
102
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
145
- CommitDate: 2022-04-11 12:39:39 +0900
146
-
147
- Bump actions/upload-artifact from 2 to 3
148
-
149
- Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
150
- - [Release notes](https://github.com/actions/upload-artifact/releases)
151
- - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)
152
-
153
- ---
154
- updated-dependencies:
155
- - dependency-name: actions/upload-artifact
156
- dependency-type: direct:production
157
- update-type: version-update:semver-major
158
- ...
159
-
160
- Signed-off-by: dependabot[bot] <support@github.com>
161
-
162
- commit a3f0ec21b19bd26111f1025fd8434e55beef309d
163
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
164
- AuthorDate: 2022-04-04 15:05:15 +0900
165
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
166
- CommitDate: 2022-04-04 15:05:15 +0900
167
-
168
- Define `inspect` and `pretty_inspect`
169
-
170
- commit 482a42668e7228485b3274cfb0523af87ab44e56
171
- Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
172
- AuthorDate: 2022-03-25 16:56:25 +0900
173
- Commit: GitHub <noreply@github.com>
174
- CommitDate: 2022-03-25 16:56:25 +0900
175
-
176
- Bump actions/checkout from 2 to 3 (#31)
177
-
178
- Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
179
- - [Release notes](https://github.com/actions/checkout/releases)
180
- - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
181
- - [Commits](https://github.com/actions/checkout/compare/v2...v3)
182
-
183
- ---
184
- updated-dependencies:
185
- - dependency-name: actions/checkout
186
- dependency-type: direct:production
187
- update-type: version-update:semver-major
188
- ...
103
+ CommitDate: 2023-02-18 16:46:18 +0900
189
104
 
190
- Signed-off-by: dependabot[bot] <support@github.com>
191
-
192
- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
105
+ Try with Windows
193
106
 
194
- commit 5bc8b13b8806bac75f8aa0adeaa75a6631b992ec
107
+ commit 45fade52f519f656f62eb601899e3e96d3f69fca
195
108
  Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
196
- AuthorDate: 2022-03-25 16:49:09 +0900
197
- Commit: GitHub <noreply@github.com>
198
- CommitDate: 2022-03-25 16:49:09 +0900
109
+ AuthorDate: 2023-02-18 16:25:25 +0900
110
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
111
+ CommitDate: 2023-02-18 16:46:18 +0900
199
112
 
200
- Added dependabot (#30)
113
+ Use ruby/actions/.github/workflows/ruby_versions.yml@master
201
114
 
202
- commit 9e29d86c12819dc383e042cc0059224299a8fcd8
203
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
204
- AuthorDate: 2022-01-12 20:58:54 +0900
205
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
206
- CommitDate: 2022-01-12 20:58:54 +0900
207
-
208
- Fix for ruby 3.0 or earlier
115
+ commit 366a6a6b569037420013e83ada92012d0c6a2f76
116
+ Author: Keishi Tanaka <k-tanaka@ruby-dev.jp>
117
+ AuthorDate: 2023-01-21 14:09:00 +0900
118
+ Commit: GitHub <noreply@github.com>
119
+ CommitDate: 2023-01-21 14:09:00 +0900
209
120
 
210
- commit 0ac99576964657f7f44dadcca4c2546594076f88
211
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
212
- AuthorDate: 2022-01-12 19:37:33 +0900
213
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
214
- CommitDate: 2022-01-12 19:37:33 +0900
121
+ Migrate set-output to $GITHUB_OUTPUT (#50)
215
122
 
216
- DidYouMean::PlainFormatter is deprecated
123
+ https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
217
124
 
218
- commit dab72c543db6c0c0f89a470006ae71390adf0c50
219
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
220
- AuthorDate: 2022-01-12 18:22:11 +0900
125
+ commit 3e63d878f895a299a6ddeee5f8c615b69edf401c
126
+ Author: Junichi Ito <jit@sonicgarden.jp>
127
+ AuthorDate: 2022-11-29 08:07:47 +0900
221
128
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
222
- CommitDate: 2022-01-12 18:22:11 +0900
129
+ CommitDate: 2022-12-22 19:58:43 +0900
223
130
 
224
- Fix links to the page directory files
131
+ Add symbolize_names to getopts
225
132
 
226
- https://bugs.ruby-lang.org/issues/18468
227
-
228
- commit d182cd60b58eb6bc537f23b0309cde187309056b
133
+ commit 73661899ad17e1061c7fc0f88cc4ac4e66a3c9a9
229
134
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
230
- AuthorDate: 2022-01-12 18:17:22 +0900
135
+ AuthorDate: 2022-12-22 19:57:30 +0900
231
136
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
232
- CommitDate: 2022-01-12 18:19:40 +0900
233
-
234
- Add rdoc options
137
+ CommitDate: 2022-12-22 19:57:30 +0900
235
138
 
236
- Specify the main page and the page directory. Also in Rakefile,
237
- extract and use the same options from the gemspec file.
139
+ bump up to 0.4.0.pre.1
238
140
 
239
- commit ed283559d492e917f1c28b0ece9ea9c3e1327016
141
+ commit 697ea7bf8e343704e735fb2d1f7787d96b843469
240
142
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
241
- AuthorDate: 2022-01-12 18:16:30 +0900
143
+ AuthorDate: 2022-12-22 19:55:51 +0900
242
144
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
243
- CommitDate: 2022-01-12 18:19:39 +0900
244
-
245
- Add .document files
246
-
247
- commit e4f26821283dbf7d7dba8973e332641cff3f119f
248
- Author: David Rodríguez <deivid.rodriguez@riseup.net>
249
- AuthorDate: 2022-01-04 08:32:45 +0100
250
- Commit: GitHub <noreply@github.com>
251
- CommitDate: 2022-01-04 16:32:45 +0900
252
-
253
- Use `require_relative` for internal requires (#28)
254
-
255
- commit faf8e5c8fba85ae2dda8d9d882de4c7016b31ec5
256
- Author: Takashi Kokubun <takashikkbn@gmail.com>
257
- AuthorDate: 2021-12-14 20:49:32 -0800
258
- Commit: GitHub <noreply@github.com>
259
- CommitDate: 2021-12-14 20:49:32 -0800
145
+ CommitDate: 2022-12-22 19:55:51 +0900
260
146
 
261
- s/RubyVM::JIT/RubyVM::MJIT/g (#29)
147
+ Add .rdoc_options
262
148
 
263
- commit 61df7522f80a04ce40fc7dea655d4b016f224c83
149
+ commit ab0022bd23d77e515390cbb2c165f7647400be46
264
150
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
265
- AuthorDate: 2021-11-03 19:52:14 +0900
151
+ AuthorDate: 2021-09-29 11:47:47 +0900
266
152
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
267
- CommitDate: 2021-11-03 19:52:14 +0900
153
+ CommitDate: 2022-12-22 19:53:20 +0900
268
154
 
269
- Remove the test for deprecated DidYouMean::VerboseFormatter
155
+ Cron test
270
156
 
271
- commit 0aa18752cfcc2e9bd47afe57348ddc0fc966c981
157
+ commit 33663e2c50eb8496b81750976b3480c14783470d
272
158
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
273
- AuthorDate: 2021-11-03 18:34:13 +0900
159
+ AuthorDate: 2022-12-22 19:48:22 +0900
274
160
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
275
- CommitDate: 2021-11-03 18:34:13 +0900
161
+ CommitDate: 2022-12-22 19:50:16 +0900
276
162
 
277
- Fix typo [ci skip]
163
+ Add `helper.bump`
@@ -1,7 +1,7 @@
1
1
  == Argument Converters
2
2
 
3
3
  An option can specify that its argument is to be converted
4
- from the default \String to an instance of another class.
4
+ from the default +String+ to an instance of another class.
5
5
 
6
6
  === Contents
7
7
 
@@ -27,13 +27,13 @@ from the default \String to an instance of another class.
27
27
 
28
28
  === Built-In Argument Converters
29
29
 
30
- \OptionParser has a number of built-in argument converters,
30
+ +OptionParser+ has a number of built-in argument converters,
31
31
  which are demonstrated below.
32
32
 
33
- ==== \Date
33
+ ==== +Date+
34
34
 
35
35
  File +date.rb+
36
- defines an option whose argument is to be converted to a \Date object.
36
+ defines an option whose argument is to be converted to a +Date+ object.
37
37
  The argument is converted by method Date#parse.
38
38
 
39
39
  :include: ruby/date.rb
@@ -47,10 +47,10 @@ Executions:
47
47
  $ ruby date.rb --date "3rd Feb 2001"
48
48
  [#<Date: 2001-02-03 ((2451944j,0s,0n),+0s,2299161j)>, Date]
49
49
 
50
- ==== \DateTime
50
+ ==== +DateTime+
51
51
 
52
52
  File +datetime.rb+
53
- defines an option whose argument is to be converted to a \DateTime object.
53
+ defines an option whose argument is to be converted to a +DateTime+ object.
54
54
  The argument is converted by method DateTime#parse.
55
55
 
56
56
  :include: ruby/datetime.rb
@@ -64,10 +64,10 @@ Executions:
64
64
  $ ruby datetime.rb --datetime "3rd Feb 2001 04:05:06 PM"
65
65
  [#<DateTime: 2001-02-03T16:05:06+00:00 ((2451944j,57906s,0n),+0s,2299161j)>, DateTime]
66
66
 
67
- ==== \Time
67
+ ==== +Time+
68
68
 
69
69
  File +time.rb+
70
- defines an option whose argument is to be converted to a \Time object.
70
+ defines an option whose argument is to be converted to a +Time+ object.
71
71
  The argument is converted by method Time#httpdate or Time#parse.
72
72
 
73
73
  :include: ruby/time.rb
@@ -79,10 +79,10 @@ Executions:
79
79
  $ ruby time.rb --time 2010-10-31
80
80
  [2010-10-31 00:00:00 -0500, Time]
81
81
 
82
- ==== \URI
82
+ ==== +URI+
83
83
 
84
84
  File +uri.rb+
85
- defines an option whose argument is to be converted to a \URI object.
85
+ defines an option whose argument is to be converted to a +URI+ object.
86
86
  The argument is converted by method URI#parse.
87
87
 
88
88
  :include: ruby/uri.rb
@@ -96,10 +96,10 @@ Executions:
96
96
  $ ruby uri.rb --uri file://~/var
97
97
  [#<URI::File file://~/var>, URI::File]
98
98
 
99
- ==== \Shellwords
99
+ ==== +Shellwords+
100
100
 
101
101
  File +shellwords.rb+
102
- defines an option whose argument is to be converted to an \Array object by method
102
+ defines an option whose argument is to be converted to an +Array+ object by method
103
103
  Shellwords#shellwords.
104
104
 
105
105
  :include: ruby/shellwords.rb
@@ -111,10 +111,10 @@ Executions:
111
111
  $ ruby shellwords.rb --shellwords "here are 'two words'"
112
112
  [["here", "are", "two words"], Array]
113
113
 
114
- ==== \Integer
114
+ ==== +Integer+
115
115
 
116
116
  File +integer.rb+
117
- defines an option whose argument is to be converted to an \Integer object.
117
+ defines an option whose argument is to be converted to an +Integer+ object.
118
118
  The argument is converted by method Kernel#Integer.
119
119
 
120
120
  :include: ruby/integer.rb
@@ -132,10 +132,10 @@ Executions:
132
132
  $ ruby integer.rb --integer 0b100
133
133
  [4, Integer]
134
134
 
135
- ==== \Float
135
+ ==== +Float+
136
136
 
137
137
  File +float.rb+
138
- defines an option whose argument is to be converted to a \Float object.
138
+ defines an option whose argument is to be converted to a +Float+ object.
139
139
  The argument is converted by method Kernel#Float.
140
140
 
141
141
  :include: ruby/float.rb
@@ -151,11 +151,11 @@ Executions:
151
151
  $ ruby float.rb --float 1.234E-2
152
152
  [0.01234, Float]
153
153
 
154
- ==== \Numeric
154
+ ==== +Numeric+
155
155
 
156
156
  File +numeric.rb+
157
157
  defines an option whose argument is to be converted to an instance
158
- of \Rational, \Float, or \Integer.
158
+ of +Rational+, +Float+, or +Integer+.
159
159
  The argument is converted by method Kernel#Rational,
160
160
  Kernel#Float, or Kernel#Integer.
161
161
 
@@ -170,10 +170,10 @@ Executions:
170
170
  $ ruby numeric.rb --numeric 3
171
171
  [3, Integer]
172
172
 
173
- ==== \DecimalInteger
173
+ ==== +DecimalInteger+
174
174
 
175
175
  File +decimal_integer.rb+
176
- defines an option whose argument is to be converted to an \Integer object.
176
+ defines an option whose argument is to be converted to an +Integer+ object.
177
177
  The argument is converted by method Kernel#Integer.
178
178
 
179
179
  :include: ruby/decimal_integer.rb
@@ -192,10 +192,10 @@ Executions:
192
192
  $ ruby decimal_integer.rb --decimal_integer -0100
193
193
  [-100, Integer]
194
194
 
195
- ==== \OctalInteger
195
+ ==== +OctalInteger+
196
196
 
197
197
  File +octal_integer.rb+
198
- defines an option whose argument is to be converted to an \Integer object.
198
+ defines an option whose argument is to be converted to an +Integer+ object.
199
199
  The argument is converted by method Kernel#Integer.
200
200
 
201
201
  :include: ruby/octal_integer.rb
@@ -212,10 +212,10 @@ Executions:
212
212
  $ ruby octal_integer.rb --octal_integer 0100
213
213
  [64, Integer]
214
214
 
215
- ==== \DecimalNumeric
215
+ ==== +DecimalNumeric+
216
216
 
217
217
  File +decimal_numeric.rb+
218
- defines an option whose argument is to be converted to an \Integer object.
218
+ defines an option whose argument is to be converted to an +Integer+ object.
219
219
  The argument is converted by method Kernel#Integer
220
220
 
221
221
  :include: ruby/decimal_numeric.rb
@@ -232,7 +232,7 @@ Executions:
232
232
  $ ruby decimal_numeric.rb --decimal_numeric 0100
233
233
  [64, Integer]
234
234
 
235
- ==== \TrueClass
235
+ ==== +TrueClass+
236
236
 
237
237
  File +true_class.rb+
238
238
  defines an option whose argument is to be converted to +true+ or +false+.
@@ -259,7 +259,7 @@ Executions:
259
259
  $ ruby true_class.rb --true_class nil
260
260
  [false, FalseClass]
261
261
 
262
- ==== \FalseClass
262
+ ==== +FalseClass+
263
263
 
264
264
  File +false_class.rb+
265
265
  defines an option whose argument is to be converted to +true+ or +false+.
@@ -286,10 +286,10 @@ Executions:
286
286
  $ ruby false_class.rb --false_class +
287
287
  [true, TrueClass]
288
288
 
289
- ==== \Object
289
+ ==== +Object+
290
290
 
291
291
  File +object.rb+
292
- defines an option whose argument is not to be converted from \String.
292
+ defines an option whose argument is not to be converted from +String+.
293
293
 
294
294
  :include: ruby/object.rb
295
295
 
@@ -300,10 +300,10 @@ Executions:
300
300
  $ ruby object.rb --object nil
301
301
  ["nil", String]
302
302
 
303
- ==== \String
303
+ ==== +String+
304
304
 
305
305
  File +string.rb+
306
- defines an option whose argument is not to be converted from \String.
306
+ defines an option whose argument is not to be converted from +String+.
307
307
 
308
308
  :include: ruby/string.rb
309
309
 
@@ -314,10 +314,10 @@ Executions:
314
314
  $ ruby string.rb --string nil
315
315
  ["nil", String]
316
316
 
317
- ==== \Array
317
+ ==== +Array+
318
318
 
319
319
  File +array.rb+
320
- defines an option whose argument is to be converted from \String
320
+ defines an option whose argument is to be converted from +String+
321
321
  to an array of strings, based on comma-separated substrings.
322
322
 
323
323
  :include: ruby/array.rb
@@ -331,10 +331,10 @@ Executions:
331
331
  $ ruby array.rb --array "foo, bar, baz"
332
332
  [["foo", " bar", " baz"], Array]
333
333
 
334
- ==== \Regexp
334
+ ==== +Regexp+
335
335
 
336
336
  File +regexp.rb+
337
- defines an option whose argument is to be converted to a \Regexp object.
337
+ defines an option whose argument is to be converted to a +Regexp+ object.
338
338
 
339
339
  :include: ruby/regexp.rb
340
340
 
@@ -352,7 +352,7 @@ To create a custom converter, call OptionParser#accept with:
352
352
  - A block that accepts the argument and returns the converted value.
353
353
 
354
354
  This custom converter accepts any argument and converts it,
355
- if possible, to a \Complex object.
355
+ if possible, to a +Complex+ object.
356
356
 
357
357
  :include: ruby/custom_converter.rb
358
358
 
@@ -1,6 +1,6 @@
1
1
  == Parameters for New Options
2
2
 
3
- Option-creating methods in \OptionParser
3
+ Option-creating methods in +OptionParser+
4
4
  accept arguments that determine the behavior of a new option:
5
5
 
6
6
  - OptionParser#on
@@ -405,7 +405,7 @@ Executions:
405
405
  === Argument Converters
406
406
 
407
407
  An option can specify that its argument is to be converted
408
- from the default \String to an instance of another class.
408
+ from the default +String+ to an instance of another class.
409
409
 
410
410
  There are a number of built-in converters.
411
411
  You can also define custom converters.
@@ -1,10 +1,10 @@
1
1
  == Tutorial
2
2
 
3
- === Why \OptionParser?
3
+ === Why +OptionParser+?
4
4
 
5
5
  When a Ruby program executes, it captures its command-line arguments
6
6
  and options into variable ARGV.
7
- This simple program just prints its \ARGV:
7
+ This simple program just prints its +ARGV+:
8
8
 
9
9
  :include: ruby/argv.rb
10
10
 
@@ -18,7 +18,7 @@ the command-line options.
18
18
 
19
19
  OptionParser offers methods for parsing and handling those options.
20
20
 
21
- With \OptionParser, you can define options so that for each option:
21
+ With +OptionParser+, you can define options so that for each option:
22
22
 
23
23
  - The code that defines the option and code that handles that option
24
24
  are in the same place.
@@ -55,7 +55,7 @@ The class also has method #help, which displays automatically-generated help tex
55
55
  - {Argument Converters}[#label-Argument+Converters]
56
56
  - {Help}[#label-Help]
57
57
  - {Top List and Base List}[#label-Top+List+and+Base+List]
58
- - {Defining Options}[#label-Defining+Options]
58
+ - {Methods for Defining Options}[#label-Methods+for+Defining+Options]
59
59
  - {Parsing}[#label-Parsing]
60
60
  - {Method parse!}[#label-Method+parse-21]
61
61
  - {Method parse}[#label-Method+parse]
@@ -66,10 +66,10 @@ The class also has method #help, which displays automatically-generated help tex
66
66
 
67
67
  === To Begin With
68
68
 
69
- To use \OptionParser:
69
+ To use +OptionParser+:
70
70
 
71
- 1. Require the \OptionParser code.
72
- 2. Create an \OptionParser object.
71
+ 1. Require the +OptionParser+ code.
72
+ 2. Create an +OptionParser+ object.
73
73
  3. Define one or more options.
74
74
  4. Parse the command line.
75
75
 
@@ -92,9 +92,9 @@ the block defined for the option is called with the argument value.
92
92
  An invalid option raises an exception.
93
93
 
94
94
  Method #parse!, which is used most often in this tutorial,
95
- removes from \ARGV the options and arguments it finds,
95
+ removes from +ARGV+ the options and arguments it finds,
96
96
  leaving other non-option arguments for the program to handle on its own.
97
- The method returns the possibly-reduced \ARGV array.
97
+ The method returns the possibly-reduced +ARGV+ array.
98
98
 
99
99
  Executions:
100
100
 
@@ -115,7 +115,7 @@ Executions:
115
115
 
116
116
  === Defining Options
117
117
 
118
- A common way to define an option in \OptionParser
118
+ A common way to define an option in +OptionParser+
119
119
  is with instance method OptionParser#on.
120
120
 
121
121
  The method may be called with any number of arguments
@@ -522,11 +522,11 @@ Executions:
522
522
  === Argument Converters
523
523
 
524
524
  An option can specify that its argument is to be converted
525
- from the default \String to an instance of another class.
525
+ from the default +String+ to an instance of another class.
526
526
  There are a number of built-in converters.
527
527
 
528
528
  Example: File +date.rb+
529
- defines an option whose argument is to be converted to a \Date object.
529
+ defines an option whose argument is to be converted to a +Date+ object.
530
530
  The argument is converted by method Date#parse.
531
531
 
532
532
  :include: ruby/date.rb
@@ -546,7 +546,7 @@ for both built-in and custom converters.
546
546
 
547
547
  === Help
548
548
 
549
- \OptionParser makes automatically generated help text available.
549
+ +OptionParser+ makes automatically generated help text available.
550
550
 
551
551
  The help text consists of:
552
552
 
@@ -614,49 +614,49 @@ Execution:
614
614
 
615
615
  === Top List and Base List
616
616
 
617
- An \OptionParser object maintains a stack of \OptionParser::List objects,
617
+ An +OptionParser+ object maintains a stack of OptionParser::List objects,
618
618
  each of which has a collection of zero or more options.
619
619
  It is unlikely that you'll need to add or take away from that stack.
620
620
 
621
621
  The stack includes:
622
622
 
623
- - The <em>top list</em>, given by \OptionParser#top.
624
- - The <em>base list</em>, given by \OptionParser#base.
623
+ - The <em>top list</em>, given by OptionParser#top.
624
+ - The <em>base list</em>, given by OptionParser#base.
625
625
 
626
- When \OptionParser builds its help text, the options in the top list
626
+ When +OptionParser+ builds its help text, the options in the top list
627
627
  precede those in the base list.
628
628
 
629
- === Defining Options
629
+ === Methods for Defining Options
630
630
 
631
631
  Option-defining methods allow you to create an option, and also append/prepend it
632
632
  to the top list or append it to the base list.
633
633
 
634
634
  Each of these next three methods accepts a sequence of parameter arguments and a block,
635
- creates an option object using method \Option#make_switch (see below),
635
+ creates an option object using method OptionParser#make_switch (see below),
636
636
  and returns the created option:
637
637
 
638
- - \Method \OptionParser#define appends the created option to the top list.
638
+ - \Method OptionParser#define appends the created option to the top list.
639
639
 
640
- - \Method \OptionParser#define_head prepends the created option to the top list.
640
+ - \Method OptionParser#define_head prepends the created option to the top list.
641
641
 
642
- - \Method \OptionParser#define_tail appends the created option to the base list.
642
+ - \Method OptionParser#define_tail appends the created option to the base list.
643
643
 
644
644
  These next three methods are identical to the three above,
645
645
  except for their return values:
646
646
 
647
- - \Method \OptionParser#on is identical to method \OptionParser#define,
647
+ - \Method OptionParser#on is identical to method OptionParser#define,
648
648
  except that it returns the parser object +self+.
649
649
 
650
- - \Method \OptionParser#on_head is identical to method \OptionParser#define_head,
650
+ - \Method OptionParser#on_head is identical to method OptionParser#define_head,
651
651
  except that it returns the parser object +self+.
652
652
 
653
- - \Method \OptionParser#on_tail is identical to method \OptionParser#define_tail,
653
+ - \Method OptionParser#on_tail is identical to method OptionParser#define_tail,
654
654
  except that it returns the parser object +self+.
655
655
 
656
656
  Though you may never need to call it directly,
657
657
  here's the core method for defining an option:
658
658
 
659
- - \Method \OptionParser#make_switch accepts an array of parameters and a block.
659
+ - \Method OptionParser#make_switch accepts an array of parameters and a block.
660
660
  See {Parameters for New Options}[optparse/option_params.rdoc].
661
661
  This method is unlike others here in that it:
662
662
  - Accepts an <em>array of parameters</em>;
@@ -668,7 +668,7 @@ here's the core method for defining an option:
668
668
 
669
669
  === Parsing
670
670
 
671
- \OptionParser has six instance methods for parsing.
671
+ +OptionParser+ has six instance methods for parsing.
672
672
 
673
673
  Three have names ending with a "bang" (<tt>!</tt>):
674
674
 
@@ -699,9 +699,9 @@ Each of these methods:
699
699
  (see {Keyword Argument into}[#label-Keyword+Argument+into]).
700
700
  - Returns +argv+, possibly with some elements removed.
701
701
 
702
- ==== \Method parse!
702
+ ==== \Method +parse!+
703
703
 
704
- \Method parse!:
704
+ \Method +parse!+:
705
705
 
706
706
  - Accepts an optional array of string arguments +argv+;
707
707
  if not given, +argv+ defaults to the value of OptionParser#default_argv,
@@ -756,9 +756,9 @@ Processing ended by non-option found when +POSIXLY_CORRECT+ is defined:
756
756
  ["--xxx", true]
757
757
  Returned: ["input_file.txt", "output_file.txt", "-yyy", "FOO"] (Array)
758
758
 
759
- ==== \Method parse
759
+ ==== \Method +parse+
760
760
 
761
- \Method parse:
761
+ \Method +parse+:
762
762
 
763
763
  - Accepts an array of string arguments
764
764
  _or_ zero or more string arguments.
@@ -810,25 +810,25 @@ Processing ended by non-option found when +POSIXLY_CORRECT+ is defined:
810
810
  ["--xxx", true]
811
811
  Returned: ["input_file.txt", "output_file.txt", "-yyy", "FOO"] (Array)
812
812
 
813
- ==== \Method order!
813
+ ==== \Method +order!+
814
814
 
815
815
  Calling method OptionParser#order! gives exactly the same result as
816
816
  calling method OptionParser#parse! with environment variable
817
817
  +POSIXLY_CORRECT+ defined.
818
818
 
819
- ==== \Method order
819
+ ==== \Method +order+
820
820
 
821
821
  Calling method OptionParser#order gives exactly the same result as
822
822
  calling method OptionParser#parse with environment variable
823
823
  +POSIXLY_CORRECT+ defined.
824
824
 
825
- ==== \Method permute!
825
+ ==== \Method +permute!+
826
826
 
827
827
  Calling method OptionParser#permute! gives exactly the same result as
828
828
  calling method OptionParser#parse! with environment variable
829
829
  +POSIXLY_CORRECT+ _not_ defined.
830
830
 
831
- ==== \Method permute
831
+ ==== \Method +permute+
832
832
 
833
833
  Calling method OptionParser#permute gives exactly the same result as
834
834
  calling method OptionParser#parse with environment variable
data/lib/optparse.rb CHANGED
@@ -48,7 +48,7 @@
48
48
  #
49
49
  # == OptionParser
50
50
  #
51
- # === New to \OptionParser?
51
+ # === New to +OptionParser+?
52
52
  #
53
53
  # See the {Tutorial}[optparse/tutorial.rdoc].
54
54
  #
@@ -152,14 +152,14 @@
152
152
  # OptionParser supports the ability to coerce command line arguments
153
153
  # into objects for us.
154
154
  #
155
- # OptionParser comes with a few ready-to-use kinds of type
155
+ # OptionParser comes with a few ready-to-use kinds of type
156
156
  # coercion. They are:
157
157
  #
158
- # - Date -- Anything accepted by +Date.parse+
159
- # - DateTime -- Anything accepted by +DateTime.parse+
160
- # - Time -- Anything accepted by +Time.httpdate+ or +Time.parse+
161
- # - URI -- Anything accepted by +URI.parse+
162
- # - Shellwords -- Anything accepted by +Shellwords.shellwords+
158
+ # - Date -- Anything accepted by +Date.parse+ (need to require +optparse/date+)
159
+ # - DateTime -- Anything accepted by +DateTime.parse+ (need to require +optparse/date+)
160
+ # - Time -- Anything accepted by +Time.httpdate+ or +Time.parse+ (need to require +optparse/time+)
161
+ # - URI -- Anything accepted by +URI.parse+ (need to require +optparse/uri+)
162
+ # - Shellwords -- Anything accepted by +Shellwords.shellwords+ (need to require +optparse/shellwords+)
163
163
  # - String -- Any non-empty string
164
164
  # - Integer -- Any integer. Will convert octal. (e.g. 124, -3, 040)
165
165
  # - Float -- Any float. (e.g. 10, 3.14, -100E+13)
@@ -425,7 +425,7 @@
425
425
  # If you have any questions, file a ticket at http://bugs.ruby-lang.org.
426
426
  #
427
427
  class OptionParser
428
- OptionParser::Version = "0.3.0"
428
+ OptionParser::Version = "0.4.0"
429
429
 
430
430
  # :stopdoc:
431
431
  NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
@@ -1775,7 +1775,16 @@ XXX
1775
1775
  # # params["bar"] = "x" # --bar x
1776
1776
  # # params["zot"] = "z" # --zot Z
1777
1777
  #
1778
- def getopts(*args)
1778
+ # Option +symbolize_names+ (boolean) specifies whether returned Hash keys should be Symbols; defaults to +false+ (use Strings).
1779
+ #
1780
+ # params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option", symbolize_names: true)
1781
+ # # params[:a] = true # -a
1782
+ # # params[:b] = "1" # -b1
1783
+ # # params[:foo] = "1" # --foo
1784
+ # # params[:bar] = "x" # --bar x
1785
+ # # params[:zot] = "z" # --zot Z
1786
+ #
1787
+ def getopts(*args, symbolize_names: false)
1779
1788
  argv = Array === args.first ? args.shift : default_argv
1780
1789
  single_options, *long_options = *args
1781
1790
 
@@ -1804,14 +1813,14 @@ XXX
1804
1813
  end
1805
1814
 
1806
1815
  parse_in_order(argv, result.method(:[]=))
1807
- result
1816
+ symbolize_names ? result.transform_keys(&:to_sym) : result
1808
1817
  end
1809
1818
 
1810
1819
  #
1811
1820
  # See #getopts.
1812
1821
  #
1813
- def self.getopts(*args)
1814
- new.getopts(*args)
1822
+ def self.getopts(*args, symbolize_names: false)
1823
+ new.getopts(*args, symbolize_names: symbolize_names)
1815
1824
  end
1816
1825
 
1817
1826
  #
@@ -2084,10 +2093,23 @@ XXX
2084
2093
  f |= Regexp::IGNORECASE if /i/ =~ o
2085
2094
  f |= Regexp::MULTILINE if /m/ =~ o
2086
2095
  f |= Regexp::EXTENDED if /x/ =~ o
2087
- k = o.delete("imx")
2088
- k = nil if k.empty?
2096
+ case o = o.delete("imx")
2097
+ when ""
2098
+ when "u"
2099
+ s = s.encode(Encoding::UTF_8)
2100
+ when "e"
2101
+ s = s.encode(Encoding::EUC_JP)
2102
+ when "s"
2103
+ s = s.encode(Encoding::SJIS)
2104
+ when "n"
2105
+ f |= Regexp::NOENCODING
2106
+ else
2107
+ raise OptionParser::InvalidArgument, "unknown regexp option - #{o}"
2108
+ end
2109
+ else
2110
+ s ||= all
2089
2111
  end
2090
- Regexp.new(s || all, f, k)
2112
+ Regexp.new(s, f)
2091
2113
  end
2092
2114
 
2093
2115
  #
@@ -2276,8 +2298,8 @@ XXX
2276
2298
  # rescue OptionParser::ParseError
2277
2299
  # end
2278
2300
  #
2279
- def getopts(*args)
2280
- options.getopts(self, *args)
2301
+ def getopts(*args, symbolize_names: false)
2302
+ options.getopts(self, *args, symbolize_names: symbolize_names)
2281
2303
  end
2282
2304
 
2283
2305
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optparse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobu Nakada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2023-11-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: OptionParser is a class for command-line option analysis.
14
14
  email:
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.4.0.dev
118
+ rubygems_version: 3.5.0.dev
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: OptionParser is a class for command-line option analysis.