diff options
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r-- | lib/optparse.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index 8b0991506a..ad20ce77a4 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1646,7 +1646,12 @@ XXX end begin opt, cb, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq} + rescue ParseError + raise $!.set_option(arg, arg.length > 2) + else raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}" + end + begin argv.unshift(opt) if opt and (!rest or (opt = opt.sub(/\A-*/, '-')) != '-') val = cb.call(val) if cb setter.call(sw.switch_name, val) if setter |