optparse 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45145f867a14905754ed4e60fa3a217e5dd141afac7763be973a90aa488a4e1d
4
- data.tar.gz: 925392a4e752b2fd4dbd2a26b9446e580c4c2e375611659d705b7f685b149c9a
3
+ metadata.gz: 418e5857a7b44f43280185c3b47044dfeeae912cdfbb1732e1d449959d2f7ea6
4
+ data.tar.gz: 7bc504678e83873db67b7a70cbf70a9795e6d5c8910ad7829ecc0f161eb09e91
5
5
  SHA512:
6
- metadata.gz: 1cbaf965329a82b9ec5ba8af7f4f56e4e91b54f4dfc524d0a1aa3abe4a72f5f2bb64af95d2a1d504bb3dd4cb24243dcf8aa346fbd14caf9959045bb9edf2d73b
7
- data.tar.gz: 8e3c1ee8582ad9b524db35a864c0eafd4adcf4dd6475bb8c2faa6cad0aad1f3fe17617a681fb4319f632fa205a175be45f29920eeca9404a8b662f41565edb64
6
+ metadata.gz: 5145d4416caf4eb5a64cf415548d56ae7b533089d29b83bd16876fdbde1c644f4b260e1aa3a68010d92107e065f9197c2e0e8691997d80261c5542bbc95ff6ef
7
+ data.tar.gz: 37cb54b326baa9239ed1366ff2ad465352b8de03a32360f2a4d49e9214a1d6bb01916ebff354787ec378b7d7deb50b2444a1e45eac215fa335b21156ba594818
data/ChangeLog CHANGED
@@ -1,264 +1,277 @@
1
1
  -*- coding: utf-8 -*-
2
2
 
3
- commit 1226b670e60d5ec8ad4c1a6b73040c9fdcf40fe2
3
+ commit c80dfb1ebd9e92142de4a0719f7fb91d753c35e5
4
4
  Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
5
- AuthorDate: 2021-10-21 20:38:56 +0900
5
+ AuthorDate: 2022-12-05 16:17:01 +0900
6
6
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
7
- CommitDate: 2021-10-21 20:38:56 +0900
7
+ CommitDate: 2022-12-05 16:17:01 +0900
8
8
 
9
- Bump up optparse version to 0.2.0
9
+ Bump version to 0.3.0
10
10
 
11
- commit 0281b949c6cf86806a260ca6b39267d9b202fbf8
12
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
13
- AuthorDate: 2021-09-29 11:45:11 +0900
14
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
15
- CommitDate: 2021-09-29 11:45:11 +0900
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
16
 
17
- Add the argument from where synchronize tools
18
-
19
- commit a3d05c1be8efb552b64f3d1af84b8b8dea8e0afb
20
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
21
- AuthorDate: 2021-09-29 11:34:44 +0900
22
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
23
- CommitDate: 2021-09-29 11:34:44 +0900
17
+ Fix the test failure i ruby/ruby
24
18
 
25
- Revived `rdoc` task
19
+ ```
20
+ $ make test-all TESTS=test/optparse/
21
+ ...
26
22
 
27
- commit 6a2fa9737f5dab99c73a99a24472f620fff228ea
28
- Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
29
- AuthorDate: 2021-09-11 13:21:00 +0900
30
- Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
31
- CommitDate: 2021-09-11 13:21:00 +0900
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
+ ```
32
29
 
33
- Bump up the latest version of CoreAssertions
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.
34
35
 
35
- commit bf03038d953902569c11448717ab584c65e35a89
36
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
37
- AuthorDate: 2021-04-22 14:22:11 -0500
38
- Commit: Burdette Lamar <BurdetteLamar@Yahoo.com>
39
- CommitDate: 2021-04-22 14:22:11 -0500
36
+ As a tentative solution, this changes the option names in TestOptionParser to
37
+ avoid the name conflict with TestOptionParserDidYouMean.
40
38
 
41
- Fix link in included file
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
42
44
 
43
- commit 47417f1b4cb5d819aa54f305a4009f45d7a112c1
44
- Author: Olle Jonsson <olle.jonsson@gmail.com>
45
- AuthorDate: 2021-04-23 13:04:25 +0200
46
- Commit: GitHub <noreply@github.com>
47
- CommitDate: 2021-04-23 06:04:25 -0500
45
+ Add `raise_unknown` flag (#38)
48
46
 
49
- Remove an errant { character (#26)
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
50
52
 
51
- commit 40d51ccbad75ab5194ce5a3574b49fda41745849
52
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
53
- AuthorDate: 2021-04-22 08:48:23 -0500
54
- Commit: GitHub <noreply@github.com>
55
- CommitDate: 2021-04-22 08:48:23 -0500
53
+ Use class methods of `File` over `IO`
56
54
 
57
- More on tutorial (#24)
55
+ commit 51f7e060ee6e2ccab6b052e7fb14532bc3485ce2
56
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
57
+ AuthorDate: 2022-10-29 22:25:42 +0900
58
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
59
+ CommitDate: 2022-10-29 22:46:59 +0900
58
60
 
59
- - Adds section "Parsing" to tutorial.rdoc.
60
- - Removes section "Terminators" from option_params.rdoc. (Terminator '--' is not an option parameter.)
61
+ Add tests for `load(into:)`
61
62
 
62
- commit 7f3195b9dbc3a984a5d3e928a9d70686484411c0
63
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
64
- AuthorDate: 2021-04-22 07:27:06 -0500
63
+ commit 2ea626fcff72b68b5ae6e1381c28f5db94de7e94
64
+ Author: Whyme Lyu <5longluna@gmail.com>
65
+ AuthorDate: 2022-10-29 21:46:23 +0800
65
66
  Commit: GitHub <noreply@github.com>
66
- CommitDate: 2021-04-22 07:27:06 -0500
67
+ CommitDate: 2022-10-29 22:46:23 +0900
68
+
69
+ #load() into hash (#42)
67
70
 
68
- More on tutorial (#23)
71
+ OptionParser#load learns .load(into: Hash)
69
72
 
70
- - Removed a largish block of repeated text.
71
- - Added sections "Top List and Base List" and "Methods for Defining Options" (on, define, etc.).
72
- - Linked from class OptionParser doc to the tutorial.
73
+ Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
73
74
 
74
- commit 7ef3d89e7859552daa057b6d5f42ffe3e562ae34
75
+ commit fb34a1d3a36aa33a5d2a02d511fbd705887505b0
75
76
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
76
- AuthorDate: 2021-04-16 12:57:55 +0900
77
+ AuthorDate: 2022-10-29 22:23:14 +0900
77
78
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
78
- CommitDate: 2021-04-16 12:57:55 +0900
79
+ CommitDate: 2022-10-29 22:40:11 +0900
79
80
 
80
- Removed a duplicate section
81
+ Add tests for `OptionParser#load`
81
82
 
82
- commit 9c5b3f244b723e0231ef07c56c59dabf56a9dd3f
83
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
84
- AuthorDate: 2021-04-15 09:32:02 -0500
83
+ commit 078638ee6da875680ebcfd06efa50bb573fd1af2
84
+ Author: Maciek Rząsa <maciejrzasa@gmail.com>
85
+ AuthorDate: 2022-10-08 12:30:12 +0200
85
86
  Commit: GitHub <noreply@github.com>
86
- CommitDate: 2021-04-15 09:32:02 -0500
87
-
88
- More on tutorial (#22)
87
+ CommitDate: 2022-10-08 19:30:12 +0900
89
88
 
90
- Adds argument abbreviation in option_params.rdoc.
91
- Adds entire Argument Values section to tutorial.rdoc.
89
+ Don't treat empty string as an option description
92
90
 
93
- commit d07cb96a9616ae7489e41db7bb85e43a9b664831
94
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
95
- AuthorDate: 2021-04-12 20:33:19 -0500
96
- Commit: GitHub <noreply@github.com>
97
- CommitDate: 2021-04-13 10:33:19 +0900
91
+ commit 3bcca8a81574aaef19a6ba09f91fc1e318aadfa4
92
+ Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
93
+ AuthorDate: 2022-06-17 18:35:47 +0900
94
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
95
+ CommitDate: 2022-06-17 18:41:16 +0900
98
96
 
99
- Rdoc for help (#21)
97
+ Update Ruby versions on GHA with ci_versions/all.json
100
98
 
101
- commit 385dd4322de67a989e5d271ed7ddb96b2375956f
102
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
103
- AuthorDate: 2021-04-11 23:43:02 -0500
99
+ commit f2b8318631d3d265131a0b281ee730025eda9027
100
+ Author: konsolebox <konsolebox@gmail.com>
101
+ AuthorDate: 2022-06-09 19:43:24 +0800
104
102
  Commit: GitHub <noreply@github.com>
105
- CommitDate: 2021-04-12 06:43:02 +0200
103
+ CommitDate: 2022-06-09 20:43:24 +0900
106
104
 
107
- Tutorial: explain custom argument converters (#19)
105
+ Also accept '-' as an optional argument (#35)
108
106
 
109
- commit f23d750d14936c0e3663f65ad1b97be82d232dae
110
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
111
- AuthorDate: 2021-04-12 02:02:11 +0900
112
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
113
- CommitDate: 2021-04-12 02:02:11 +0900
107
+ commit e70e689deddb6c1d72e2073a5c4723b3fdfff68c
108
+ Author: ydah <13041216+ydah@users.noreply.github.com>
109
+ AuthorDate: 2022-05-21 06:24:41 +0900
110
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
111
+ CommitDate: 2022-05-21 08:47:36 +0900
114
112
 
115
- nodoc private methods
113
+ Fix typo in documentation
116
114
 
117
- commit 7e65ef3cfa3a38aaac3a61e1a82307427f1d27c1
118
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
119
- AuthorDate: 2021-04-12 00:38:40 +0900
120
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
121
- CommitDate: 2021-04-12 00:38:40 +0900
115
+ - "hypnen" -> "hyphen"
116
+ - "hadler" -> "handler"
122
117
 
123
- Fixed mismatched <tt> tag
118
+ commit 4b47d9c24b3b143bc661c3ef5d0de9f71882b4ce
119
+ Author: Jeremy Evans <code@jeremyevans.net>
120
+ AuthorDate: 2022-04-22 13:01:43 -0700
121
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
122
+ CommitDate: 2022-05-02 20:12:12 +0900
124
123
 
125
- commit cccb28e0debbf0f96162291766d3ccafc2c558a3
126
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
127
- AuthorDate: 2021-04-11 09:03:07 +0900
128
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
129
- CommitDate: 2021-04-11 09:03:07 +0900
124
+ Avoid defining the same test class in multiple files
130
125
 
131
- Moved rdoc files to doc/optparse
126
+ Should fix issues with parallel testing sometimes not running all
127
+ tests.
132
128
 
133
- commit 8be031b5392cb440f3df23304805c8c814265c59
134
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
135
- AuthorDate: 2021-04-11 08:49:30 +0900
136
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
137
- CommitDate: 2021-04-11 08:51:44 +0900
129
+ This should be viewed skipping whitespace changes.
138
130
 
139
- Fix relative paths
131
+ Fixes [Bug #18731]
140
132
 
141
- commit 01c24ca4f606a455b8d135a48e11a0371ef6d7c0
142
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
143
- AuthorDate: 2021-04-11 08:24:03 +0900
144
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
145
- CommitDate: 2021-04-11 08:24:03 +0900
146
-
147
- Added `rdoc` task
148
-
149
- commit 4ff48f24c9b44740dd6c63bc5005db8959c21f80
150
- Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
151
- AuthorDate: 2021-04-09 23:20:03 +0900
152
- Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
153
- CommitDate: 2021-04-11 08:10:41 +0900
133
+ commit 2bea3b38c354c3a49b5705f9f560eef522b4b1e2
134
+ Author: Peter Zhu <peter@peterzhu.ca>
135
+ AuthorDate: 2022-04-14 11:15:57 -0400
136
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
137
+ CommitDate: 2022-04-15 14:21:13 +0900
154
138
 
155
- No document in rakelib
139
+ Fix broken links in docs
156
140
 
157
- commit 39d39676c45083953a082c4f6e2e8a7315b7066d
158
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
159
- AuthorDate: 2021-04-10 16:30:19 -0500
160
- Commit: GitHub <noreply@github.com>
161
- CommitDate: 2021-04-10 16:30:19 -0500
141
+ commit 3653d5b909d876d3322546a4c2157ea5a94df1b9
142
+ Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
143
+ AuthorDate: 2022-04-11 03:21:22 +0000
144
+ Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
145
+ CommitDate: 2022-04-11 12:39:39 +0900
162
146
 
163
- More on tutorial (#16)
147
+ Bump actions/upload-artifact from 2 to 3
164
148
 
165
- - Added example in "Argument Converters"; it doesn't seem right for a tutorial to have no example in one of its topics (and instead just linking elsewhere).
166
- - Added section "Command-Line Abbreviations."
167
- - Added section "Keyword Argument into," showing how to:
168
- - Collect options.
169
- - Check for missing options.
170
- - Provide option defaults.
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)
171
152
 
172
- commit c91ed8d33db7355cf0a5a8323f3f6aad57e18b38
173
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
174
- AuthorDate: 2021-04-10 10:05:44 -0500
175
- Commit: GitHub <noreply@github.com>
176
- CommitDate: 2021-04-10 10:05:44 -0500
153
+ ---
154
+ updated-dependencies:
155
+ - dependency-name: actions/upload-artifact
156
+ dependency-type: direct:production
157
+ update-type: version-update:semver-major
158
+ ...
177
159
 
178
- Rdoc (#15)
160
+ Signed-off-by: dependabot[bot] <support@github.com>
179
161
 
180
- * Resolve shared mixed_names.rb
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
181
167
 
182
- * Add long option with negation
168
+ Define `inspect` and `pretty_inspect`
183
169
 
184
- * Show --help for all examples
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
185
175
 
186
- * Table of contents for tutorial
176
+ Bump actions/checkout from 2 to 3 (#31)
187
177
 
188
- * Move argument converters to separate rdoc
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)
189
182
 
190
- * Add references to argument_converters.rdoc
183
+ ---
184
+ updated-dependencies:
185
+ - dependency-name: actions/checkout
186
+ dependency-type: direct:production
187
+ update-type: version-update:semver-major
188
+ ...
191
189
 
192
- * Tune up argument converters
190
+ Signed-off-by: dependabot[bot] <support@github.com>
193
191
 
194
- * Change explicit links to auto-links
192
+ Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
195
193
 
196
- commit 9a2352c1c9c3445d1618da577f19137243a2a748
197
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
198
- AuthorDate: 2021-04-09 08:21:34 -0500
194
+ commit 5bc8b13b8806bac75f8aa0adeaa75a6631b992ec
195
+ Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
196
+ AuthorDate: 2022-03-25 16:49:09 +0900
199
197
  Commit: GitHub <noreply@github.com>
200
- CommitDate: 2021-04-09 08:21:34 -0500
198
+ CommitDate: 2022-03-25 16:49:09 +0900
201
199
 
202
- Reorganize Ruby example files for sharing (#14)
200
+ Added dependabot (#30)
203
201
 
204
- commit f3ca83caff20f6daf07a70a3f3f41a6666790b6c
205
- Author: Olle Jonsson <olle.jonsson@gmail.com>
206
- AuthorDate: 2021-04-08 05:33:56 +0200
207
- Commit: GitHub <noreply@github.com>
208
- CommitDate: 2021-04-08 12:33:56 +0900
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
209
207
 
210
- gemspec: Explicit files list (#10)
208
+ Fix for ruby 3.0 or earlier
211
209
 
212
- This avoid shelling out, and includes a narrower list of files.
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
213
215
 
214
- Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
216
+ DidYouMean::PlainFormatter is deprecated
215
217
 
216
- commit d55d9284c3a02a794d63a842764591d4ff079241
217
- Author: BurdetteLamar <burdettelamar@yahoo.com>
218
- AuthorDate: 2021-04-07 11:58:46 -0500
218
+ commit dab72c543db6c0c0f89a470006ae71390adf0c50
219
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
220
+ AuthorDate: 2022-01-12 18:22:11 +0900
219
221
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
220
- CommitDate: 2021-04-08 10:40:59 +0900
222
+ CommitDate: 2022-01-12 18:22:11 +0900
221
223
 
222
- Make use of option_params.rdoc
224
+ Fix links to the page directory files
223
225
 
224
- commit 5618eeb49ee2a316cd5d91a515dbb2734f553027
225
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
226
- AuthorDate: 2021-04-07 09:01:52 -0500
227
- Commit: GitHub <noreply@github.com>
228
- CommitDate: 2021-04-07 16:01:52 +0200
226
+ https://bugs.ruby-lang.org/issues/18468
229
227
 
230
- Enhanced doc for option parameters (#11)
228
+ commit d182cd60b58eb6bc537f23b0309cde187309056b
229
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
230
+ AuthorDate: 2022-01-12 18:17:22 +0900
231
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
232
+ CommitDate: 2022-01-12 18:19:40 +0900
231
233
 
232
- commit 84dfd92d2a7fb75bb40fbb8414bd8b90b7ccbac6
233
- Author: Burdette Lamar <BurdetteLamar@Yahoo.com>
234
- AuthorDate: 2021-04-06 13:55:21 -0500
235
- Commit: GitHub <noreply@github.com>
236
- CommitDate: 2021-04-06 13:55:21 -0500
234
+ Add rdoc options
237
235
 
238
- More on tutorial (#9)
236
+ Specify the main page and the page directory. Also in Rakefile,
237
+ extract and use the same options from the gemspec file.
239
238
 
240
- * More on tutorial
239
+ commit ed283559d492e917f1c28b0ece9ea9c3e1327016
240
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
241
+ AuthorDate: 2022-01-12 18:16:30 +0900
242
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
243
+ CommitDate: 2022-01-12 18:19:39 +0900
241
244
 
242
- * More on tutorial
245
+ Add .document files
243
246
 
244
- * More on tutorial
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
245
252
 
246
- * More on tutorial: clearer example output
253
+ Use `require_relative` for internal requires (#28)
247
254
 
248
- commit d14bf830078c2b2c8c8bcbe60aa2a2ebb40e0b6c
249
- Author: Olle Jonsson <olle.jonsson@gmail.com>
250
- AuthorDate: 2021-04-06 10:01:37 +0200
255
+ commit faf8e5c8fba85ae2dda8d9d882de4c7016b31ec5
256
+ Author: Takashi Kokubun <takashikkbn@gmail.com>
257
+ AuthorDate: 2021-12-14 20:49:32 -0800
251
258
  Commit: GitHub <noreply@github.com>
252
- CommitDate: 2021-04-06 10:01:37 +0200
259
+ CommitDate: 2021-12-14 20:49:32 -0800
253
260
 
254
- gemspec: Explicitly list 0 executables
261
+ s/RubyVM::JIT/RubyVM::MJIT/g (#29)
255
262
 
256
- This gem exposes no executable files.
263
+ commit 61df7522f80a04ce40fc7dea655d4b016f224c83
264
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
265
+ AuthorDate: 2021-11-03 19:52:14 +0900
266
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
267
+ CommitDate: 2021-11-03 19:52:14 +0900
268
+
269
+ Remove the test for deprecated DidYouMean::VerboseFormatter
257
270
 
258
- commit f209276f79d84578d4e40004ce7768194aae00cc
259
- Author: BurdetteLamar <burdettelamar@yahoo.com>
260
- AuthorDate: 2021-03-29 14:03:04 -0500
271
+ commit 0aa18752cfcc2e9bd47afe57348ddc0fc966c981
272
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
273
+ AuthorDate: 2021-11-03 18:34:13 +0900
261
274
  Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
262
- CommitDate: 2021-03-30 12:00:31 +0900
275
+ CommitDate: 2021-11-03 18:34:13 +0900
263
276
 
264
- Beginnings of tutorial
277
+ Fix typo [ci skip]
@@ -1,7 +1,7 @@
1
1
  Creates an option from the given parameters +params+.
2
- See {Parameters for New Options}[./doc/optparse/option_params_rdoc.html].
2
+ See {Parameters for New Options}[optparse/option_params.rdoc].
3
3
 
4
4
  The block, if given, is the handler for the created option.
5
5
  When the option is encountered during command-line parsing,
6
6
  the block is called with the argument given for the option, if any.
7
- See {Option Handlers}[./option_params_rdoc.html#label-Option+Handlers].
7
+ See {Option Handlers}[optparse/option_params.rdoc#label-Option+Handlers].
@@ -410,7 +410,7 @@ from the default \String to an instance of another class.
410
410
  There are a number of built-in converters.
411
411
  You can also define custom converters.
412
412
 
413
- See {Argument Converters}[./argument_converters_rdoc.html].
413
+ See {Argument Converters}[./argument_converters.rdoc].
414
414
 
415
415
  === Descriptions
416
416
 
@@ -418,7 +418,7 @@ A description parameter is any string parameter
418
418
  that is not recognized as an
419
419
  {option name}[#label-Option+Names] or a
420
420
  {terminator}[#label-Terminators];
421
- in other words, it does not begin with a hypnen.
421
+ in other words, it does not begin with a hyphen.
422
422
 
423
423
  You may give any number of description parameters;
424
424
  each becomes a line in the text generated by option <tt>--help</tt>.
@@ -453,7 +453,7 @@ when the option is encountered. The handler may be:
453
453
 
454
454
  ==== Handler Blocks
455
455
 
456
- An option hadler may be a block.
456
+ An option handler may be a block.
457
457
 
458
458
  File +block.rb+ defines an option that has a handler block.
459
459
 
@@ -541,7 +541,7 @@ Executions:
541
541
  [#<Date: 2001-02-03 ((2451944j,0s,0n),+0s,2299161j)>, Date]
542
542
 
543
543
  You can also define custom converters.
544
- See {Argument Converters}[./argument_converters_rdoc.html]
544
+ See {Argument Converters}[./argument_converters.rdoc]
545
545
  for both built-in and custom converters.
546
546
 
547
547
  === Help
@@ -657,7 +657,7 @@ Though you may never need to call it directly,
657
657
  here's the core method for defining an option:
658
658
 
659
659
  - \Method \OptionParser#make_switch accepts an array of parameters and a block.
660
- See {Parameters for New Options}[./option_params_rdoc.html].
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>;
663
663
  others accept a <em>sequence of parameter arguments</em>.
data/lib/optparse/ac.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
- require 'optparse'
2
+ require_relative '../optparse'
3
3
 
4
4
  class OptionParser::AC < OptionParser
5
5
  private
data/lib/optparse/date.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
- require 'optparse'
2
+ require_relative '../optparse'
3
3
  require 'date'
4
4
 
5
5
  OptionParser.accept(DateTime) do |s,|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'optparse'
2
+ require_relative '../optparse'
3
3
 
4
4
  class OptionParser
5
5
  # :call-seq:
@@ -2,6 +2,6 @@
2
2
  # -*- ruby -*-
3
3
 
4
4
  require 'shellwords'
5
- require 'optparse'
5
+ require_relative '../optparse'
6
6
 
7
7
  OptionParser.accept(Shellwords) {|s,| Shellwords.shellwords(s)}
data/lib/optparse/time.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
- require 'optparse'
2
+ require_relative '../optparse'
3
3
  require 'time'
4
4
 
5
5
  OptionParser.accept(Time) do |s,|
data/lib/optparse/uri.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  # -*- ruby -*-
3
3
 
4
- require 'optparse'
4
+ require_relative '../optparse'
5
5
  require 'uri'
6
6
 
7
7
  OptionParser.accept(URI) {|s,| URI.parse(s) if s}
data/lib/optparse.rb CHANGED
@@ -50,7 +50,7 @@
50
50
  #
51
51
  # === New to \OptionParser?
52
52
  #
53
- # See the {Tutorial}[./doc/optparse/tutorial_rdoc.html].
53
+ # See the {Tutorial}[optparse/tutorial.rdoc].
54
54
  #
55
55
  # === Introduction
56
56
  #
@@ -420,12 +420,12 @@
420
420
  # === Further documentation
421
421
  #
422
422
  # The above examples, along with the accompanying
423
- # {Tutorial}[./doc/optparse/tutorial_rdoc.html],
423
+ # {Tutorial}[optparse/tutorial.rdoc],
424
424
  # should be enough to learn how to use this class.
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.2.0"
428
+ OptionParser::Version = "0.3.0"
429
429
 
430
430
  # :stopdoc:
431
431
  NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
@@ -674,6 +674,29 @@ class OptionParser
674
674
  end
675
675
  end
676
676
 
677
+ def pretty_print_contents(q) # :nodoc:
678
+ if @block
679
+ q.text ":" + @block.source_location.join(":") + ":"
680
+ first = false
681
+ else
682
+ first = true
683
+ end
684
+ [@short, @long].each do |list|
685
+ list.each do |opt|
686
+ if first
687
+ q.text ":"
688
+ first = false
689
+ end
690
+ q.breakable
691
+ q.text opt
692
+ end
693
+ end
694
+ end
695
+
696
+ def pretty_print(q) # :nodoc:
697
+ q.object_group(self) {pretty_print_contents(q)}
698
+ end
699
+
677
700
  #
678
701
  # Switch that takes no arguments.
679
702
  #
@@ -693,6 +716,10 @@ class OptionParser
693
716
  def self.pattern
694
717
  Object
695
718
  end
719
+
720
+ def pretty_head # :nodoc:
721
+ "NoArgument"
722
+ end
696
723
  end
697
724
 
698
725
  #
@@ -710,6 +737,10 @@ class OptionParser
710
737
  end
711
738
  conv_arg(*parse_arg(arg, &method(:raise)))
712
739
  end
740
+
741
+ def pretty_head # :nodoc:
742
+ "Required"
743
+ end
713
744
  end
714
745
 
715
746
  #
@@ -727,18 +758,22 @@ class OptionParser
727
758
  conv_arg(arg)
728
759
  end
729
760
  end
761
+
762
+ def pretty_head # :nodoc:
763
+ "Optional"
764
+ end
730
765
  end
731
766
 
732
767
  #
733
- # Switch that takes an argument, which does not begin with '-'.
768
+ # Switch that takes an argument, which does not begin with '-' or is '-'.
734
769
  #
735
770
  class PlacedArgument < self
736
771
 
737
772
  #
738
- # Returns nil if argument is not present or begins with '-'.
773
+ # Returns nil if argument is not present or begins with '-' and is not '-'.
739
774
  #
740
775
  def parse(arg, argv, &error)
741
- if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
776
+ if !(val = arg) and (argv.empty? or /\A-./ =~ (val = argv[0]))
742
777
  return nil, block, nil
743
778
  end
744
779
  opt = (val = parse_arg(val, &error))[1]
@@ -750,6 +785,10 @@ class OptionParser
750
785
  end
751
786
  val
752
787
  end
788
+
789
+ def pretty_head # :nodoc:
790
+ "Placed"
791
+ end
753
792
  end
754
793
  end
755
794
 
@@ -781,6 +820,17 @@ class OptionParser
781
820
  @list = []
782
821
  end
783
822
 
823
+ def pretty_print(q) # :nodoc:
824
+ q.group(1, "(", ")") do
825
+ @list.each do |sw|
826
+ next unless Switch === sw
827
+ q.group(1, "(" + sw.pretty_head, ")") do
828
+ sw.pretty_print_contents(q)
829
+ end
830
+ end
831
+ end
832
+ end
833
+
784
834
  #
785
835
  # See OptionParser.accept.
786
836
  #
@@ -1098,6 +1148,7 @@ XXX
1098
1148
  @summary_indent = indent
1099
1149
  @default_argv = ARGV
1100
1150
  @require_exact = false
1151
+ @raise_unknown = true
1101
1152
  add_officious
1102
1153
  yield self if block_given?
1103
1154
  end
@@ -1175,6 +1226,9 @@ XXX
1175
1226
  # abbreviated long option as short option).
1176
1227
  attr_accessor :require_exact
1177
1228
 
1229
+ # Whether to raise at unknown option.
1230
+ attr_accessor :raise_unknown
1231
+
1178
1232
  #
1179
1233
  # Heading banner preceding summary.
1180
1234
  #
@@ -1293,6 +1347,29 @@ XXX
1293
1347
  def help; summarize("#{banner}".sub(/\n?\z/, "\n")) end
1294
1348
  alias to_s help
1295
1349
 
1350
+ def pretty_print(q) # :nodoc:
1351
+ q.object_group(self) do
1352
+ first = true
1353
+ if @stack.size > 2
1354
+ @stack.each_with_index do |s, i|
1355
+ next if i < 2
1356
+ next if s.list.empty?
1357
+ if first
1358
+ first = false
1359
+ q.text ":"
1360
+ end
1361
+ q.breakable
1362
+ s.pretty_print(q)
1363
+ end
1364
+ end
1365
+ end
1366
+ end
1367
+
1368
+ def inspect # :nodoc:
1369
+ require 'pp'
1370
+ pretty_print_inspect
1371
+ end
1372
+
1296
1373
  #
1297
1374
  # Returns option summary list.
1298
1375
  #
@@ -1429,7 +1506,7 @@ XXX
1429
1506
  style = notwice(default_style.guess(arg = o), style, 'style')
1430
1507
  default_pattern, conv = search(:atype, Object) unless default_pattern
1431
1508
  else
1432
- desc.push(o)
1509
+ desc.push(o) if o && !o.empty?
1433
1510
  end
1434
1511
  end
1435
1512
 
@@ -1566,9 +1643,11 @@ XXX
1566
1643
  begin
1567
1644
  sw, = complete(:long, opt, true)
1568
1645
  if require_exact && !sw.long.include?(arg)
1646
+ throw :terminate, arg unless raise_unknown
1569
1647
  raise InvalidOption, arg
1570
1648
  end
1571
1649
  rescue ParseError
1650
+ throw :terminate, arg unless raise_unknown
1572
1651
  raise $!.set_option(arg, true)
1573
1652
  end
1574
1653
  begin
@@ -1600,6 +1679,7 @@ XXX
1600
1679
  end
1601
1680
  end
1602
1681
  rescue ParseError
1682
+ throw :terminate, arg unless raise_unknown
1603
1683
  raise $!.set_option(arg, true)
1604
1684
  end
1605
1685
  begin
@@ -1830,10 +1910,13 @@ XXX
1830
1910
  # directory ~/.options, then the basename with '.options' suffix
1831
1911
  # under XDG and Haiku standard places.
1832
1912
  #
1833
- def load(filename = nil)
1913
+ # The optional +into+ keyword argument works exactly like that accepted in
1914
+ # method #parse.
1915
+ #
1916
+ def load(filename = nil, into: nil)
1834
1917
  unless filename
1835
1918
  basename = File.basename($0, '.*')
1836
- return true if load(File.expand_path(basename, '~/.options')) rescue nil
1919
+ return true if load(File.expand_path(basename, '~/.options'), into: into) rescue nil
1837
1920
  basename << ".options"
1838
1921
  return [
1839
1922
  # XDG
@@ -1845,11 +1928,11 @@ XXX
1845
1928
  '~/config/settings',
1846
1929
  ].any? {|dir|
1847
1930
  next if !dir or dir.empty?
1848
- load(File.expand_path(basename, dir)) rescue nil
1931
+ load(File.expand_path(basename, dir), into: into) rescue nil
1849
1932
  }
1850
1933
  end
1851
1934
  begin
1852
- parse(*IO.readlines(filename).each {|s| s.chomp!})
1935
+ parse(*File.readlines(filename, chomp: true), into: into)
1853
1936
  true
1854
1937
  rescue Errno::ENOENT, Errno::ENOTDIR
1855
1938
  false
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.2.0
4
+ version: 0.3.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: 2021-10-21 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: OptionParser is a class for command-line option analysis.
14
14
  email:
@@ -98,7 +98,10 @@ metadata:
98
98
  homepage_uri: https://github.com/ruby/optparse
99
99
  source_code_uri: https://github.com/ruby/optparse
100
100
  post_install_message:
101
- rdoc_options: []
101
+ rdoc_options:
102
+ - "--main=README.md"
103
+ - "--op=rdoc"
104
+ - "--page-dir=doc"
102
105
  require_paths:
103
106
  - lib
104
107
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -112,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
115
  - !ruby/object:Gem::Version
113
116
  version: '0'
114
117
  requirements: []
115
- rubygems_version: 3.3.0.dev
118
+ rubygems_version: 3.4.0.dev
116
119
  signing_key:
117
120
  specification_version: 4
118
121
  summary: OptionParser is a class for command-line option analysis.