optparse2 0.8.0 → 0.8.1
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/version.rb +1 -1
- data/lib/optparse2.rb +7 -15
- 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: f72b9507463f134c1c50c41330ab92e73c087764f0e378b84bff1819f52997e6
|
|
4
|
+
data.tar.gz: 0d46f1626d79f5a056a754467338dbb640e425d46b81c36747aab525ec69b340
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e647563d1b3ffc9d1f8501ae527a1de6c4069bc69cd7c81f0a456a2938f203ed22606383115a0dcf2d3ef2c71f680fa72810379cb14655608895ed10c915d04
|
|
7
|
+
data.tar.gz: 37805f0e018d3b842807cca56e5dcaf2906c5ad0c873171279816a658bc8b9dc6eb20faad51b4dbf4da4f557467895a4845e8104d5eb3b77f71afce748d1fea3
|
data/lib/optparse2/version.rb
CHANGED
data/lib/optparse2.rb
CHANGED
|
@@ -173,10 +173,13 @@ class OptParse2
|
|
|
173
173
|
ensure_all_required_arguments_were_supplied!(context)
|
|
174
174
|
|
|
175
175
|
# For each non-option argument, call the `nonopt` block
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
if nonopt
|
|
177
|
+
not_matched_options.each(&nonopt)
|
|
178
|
+
argv.clear
|
|
179
|
+
else
|
|
180
|
+
# Replace the original argv with the resulting options
|
|
181
|
+
argv.replace not_matched_options
|
|
182
|
+
end
|
|
180
183
|
end
|
|
181
184
|
rescue OptionParser::ParseError => err
|
|
182
185
|
abort ? abort(err) : raise
|
|
@@ -270,17 +273,6 @@ class OptParse2
|
|
|
270
273
|
end
|
|
271
274
|
end
|
|
272
275
|
|
|
273
|
-
__END__
|
|
274
|
-
|
|
275
|
-
OptParse2.new do |op|
|
|
276
|
-
op.switch('-f', '--foo=BAR', 'does it')
|
|
277
|
-
.default { p $x += 1 }
|
|
278
|
-
.build!
|
|
279
|
-
op.parse! into: opts={}
|
|
280
|
-
p opts
|
|
281
|
-
p $x
|
|
282
|
-
end
|
|
283
|
-
|
|
284
276
|
__END__
|
|
285
277
|
OptParse2.new do |op|
|
|
286
278
|
op.on '-f', '--foo=BAR', 'does it', default: 10, default_description: nil
|