summaryrefslogtreecommitdiff
path: root/lib/optparse.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2021-03-29 16:42:49 +0900
committerNobuyoshi Nakada <[email protected]>2021-03-29 19:37:24 +0900
commite8317d90b0b102ba270b456cc6cb7c6865c6b448 ()
tree0889564769d0de1db072887223ce2e386c6d8ca6 /lib/optparse.rb
parent2bbae0e91acf1090bbcea49476ef007162ec8e2b (diff)
[ruby/optparse] Fixed error message of unparsed non-option
Close https://.com/ruby/optparse/issues/3 https://.com/ruby/optparse/commit/94c5cf4032
-rw-r--r--lib/optparse.rb5
1 files changed, 5 insertions, 0 deletions
@@ -1646,7 +1646,12 @@ XXX
end
begin
opt, cb, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}"
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