optparse2 0.7.0 → 0.7.2
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/lib/optparse2/switch-helpers.rb +1 -1
- data/lib/optparse2/version.rb +1 -1
- data/lib/optparse2.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb111f3d0a1f0018c1541292c21c5cbe932d371bd6d786b953e2b0e1670b5371
|
|
4
|
+
data.tar.gz: bd50a260ccc35814a62339cc85e2c92496b0aaa4534505114bcd448d8ab5e5fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 306c0419abb462cdf37c12b2438419dd959639542ef3a327d5bbfe78b827e1b11c5985920dd52ff5a03c60995c14cfd6c635d7dd1b60fb34911ddd676f2f89e8
|
|
7
|
+
data.tar.gz: 44505d4e4dfc32e3ec578ebd187a79a178d987e263890f1011cd817fb20a5e27c2e4e125f94c7954eb5fd2443962b44b990d5c2ba0a5e45b6533a350539a0374
|
|
@@ -161,7 +161,7 @@ class OptParse2
|
|
|
161
161
|
|
|
162
162
|
def default_description = @default_description || default.inspect
|
|
163
163
|
def desc
|
|
164
|
-
return super unless defined? @
|
|
164
|
+
return super unless defined? @default_proc
|
|
165
165
|
x = super
|
|
166
166
|
x << '' if x.empty?
|
|
167
167
|
x[-1] += " [default: #{default_description}]"
|
data/lib/optparse2/version.rb
CHANGED
data/lib/optparse2.rb
CHANGED
|
@@ -152,7 +152,7 @@ class OptParse2
|
|
|
152
152
|
end
|
|
153
153
|
end
|
|
154
154
|
|
|
155
|
-
def order!(argv = default_argv, into: nil, **keywords, &nonopt)
|
|
155
|
+
def order!(argv = default_argv, into: nil, abort: false, **keywords, &nonopt)
|
|
156
156
|
Context.with_context into:, nonopt: do |context|
|
|
157
157
|
|
|
158
158
|
# Parse all normal options in the command line
|
|
@@ -179,6 +179,8 @@ class OptParse2
|
|
|
179
179
|
# Replace the original argv with the resulting options
|
|
180
180
|
argv.replace not_matched_options
|
|
181
181
|
end
|
|
182
|
+
rescue OptionParser::ParseError => err
|
|
183
|
+
abort ? abort(err) : raise
|
|
182
184
|
end
|
|
183
185
|
|
|
184
186
|
module Positional
|
|
@@ -283,7 +285,7 @@ OptParse2.new do |op|
|
|
|
283
285
|
p x
|
|
284
286
|
end
|
|
285
287
|
|
|
286
|
-
op.parse! %w[ -vvv --foo=abc --bar=123 --foo=xyz -a3 -a4 -a5 ], into: opts={}
|
|
288
|
+
op.parse! %w[ -vvv -q --foo=abc --bar=123 --foo=xyz -a3 -a4 -a5 ], into: opts={}
|
|
287
289
|
p opts
|
|
288
290
|
end
|
|
289
291
|
|