nobu (Nobuyoshi Nakada) wrote:
Currently, it is not able.
A possible workaround is to define an option which raise OptionParser::InvalidOption
.
Can you please show me an example code on how to achieve this ?
I see the issue is in parser_in_order
method
begin
sw, = complete(:short, opt)
# short option matched.
val = arg.sub(/\A-/, '')
has_arg = true
rescue InvalidOption
# if no short options match, try completion with long
# options.
sw, = complete(:long, opt)
eq ||= !rest
end
where if no short options match, long options are matched. I want to suppress this behaviour and instead of rescue InvalidOption
, I want to raise InvalidOption
Getoptlong
doesn't have this behaviour of automatically matching long options, similar to Option Parsers in other standard libraries like that of python for example. It'd be great if its possible to have a functionality where users of OptionParser can suppress this behaviour..