Closed micahlee closed 3 years ago
It looks like this is behavior of Ruby's OptionParse
. TIL:
> cat test.rb
require "optparse"
options = {}
OptionParser.new { |opts|
opts.on("--version") do |v|
options[:version] = true
end
}.parse!
puts options.inspect
> ruby test.rb --version
{:version=>true}
> ruby test.rb --ver
{:version=>true}
Ah, that would explain why I couldn't figure out where this was handled in GLI. 😆 Thanks!
Hello,
I recently discovered that with a CLI built using GLI, the flag arguments will match when the flag given is not an exact match. Flags that our different cases, or are a substring of the defined flag will also match.
For example, if I define a flag like:
Then it will accept the flag as expected with either
-p
or--admin-password
. However, it will also match the same flag with--admin-p
.Is this the expected behavior for flag name matching? Is there a way to make the matching strict, such that substrings are not accepted?
Thanks so much!