summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2019-10-18 17:46:53 +0900
committerNobuyoshi Nakada <[email protected]>2019-10-18 17:46:53 +0900
commite2b719bed640d4813fd5f753c80d33d01c612078 ()
tree7435050481f41ef13a893261d53e9600cf195286
parentb4d308b41939659fe8a4df28afc82eb5205709d1 (diff)
Support DidYouMean by AmbiguousOption too
-rw-r--r--lib/optparse.rb5
-rw-r--r--test/optparse/test_did_you_mean.rb6
2 files changed, 9 insertions, 2 deletions
@@ -1768,10 +1768,11 @@ XXX
if pat.empty?
search(typ, opt) {|sw| return [sw, opt]} # exact match or...
end
- raise AmbiguousOption, catch(:ambiguous) {
visit(:complete, typ, opt, icase, *pat) {|o, *sw| return sw}
- raise InvalidOption.new(opt, additional: self.:additional_message.curry[typ])
}
end
private :complete
@@ -39,4 +39,10 @@ class TestOptionParser::DidYouMean < TestOptionParser
@opt.permute!(%w"--baa")
end
end
end