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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f61087f5b177ee9ffd0a587eb64ba8ff08893468ac8e0920621ee77d7b4a1b6
4
- data.tar.gz: e5608123d52c5ad10d460f11ceb67bc9e9b0d5b145a502f9db16255e8df9ca0d
3
+ metadata.gz: eb111f3d0a1f0018c1541292c21c5cbe932d371bd6d786b953e2b0e1670b5371
4
+ data.tar.gz: bd50a260ccc35814a62339cc85e2c92496b0aaa4534505114bcd448d8ab5e5fc
5
5
  SHA512:
6
- metadata.gz: 1155a87469ff90eaf3734338e4b883f97077e85327b4099a83bf360dd5f63bc5f136da6c3dee8a4de1ce0c0d8f98c1f85ae180f845ed0615dee4aee98747b345
7
- data.tar.gz: e7099e4a6c7e2c0021a35c3b8b95ecafd632ed63bf86f26e9aca2884c42bb749d3f03c1baab1ad3527a90fb4a5434c2540ca1ac6f1ed4ce3167e7fa4eeedcc14
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? @default
164
+ return super unless defined? @default_proc
165
165
  x = super
166
166
  x << '' if x.empty?
167
167
  x[-1] += " [default: #{default_description}]"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class OptParse2
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.2"
5
5
  end
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optparse2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamW