commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
821 stars 74 forks source link

Option parsing error (incomplete option name) #6

Open ggilder opened 9 years ago

ggilder commented 9 years ago

From @d-ash on February 14, 2015 8:40

Passing only a beginning of a name triggers the option to be set.

For example, if --vagrant option is declared, passing --v or --va... to the script, works as if the full name has been passed.

However, global options work correctly (--v is not equivalent to --vagrant)

Copied from original issue: tj/commander#93

ggilder commented 9 years ago

From @d-ash on February 14, 2015 8:55

It seems that the problem is in OptionParser, and it's an old issue. Could this be corrected within Commander code?

ggilder commented 9 years ago

Do you have a link to the issue in OptionParser? I would like to understand why it hasn't been fixed there.

ggilder commented 9 years ago

From @d-ash on February 17, 2015 8:26

https://www.ruby-forum.com/topic/143551 http://stackoverflow.com/questions/20654065/how-do-i-get-only-long-options-work-in-optionparser-in-ruby I'd agree with the point that this behaviour is potentially dangerous. Options of CLI tools are very important part of UI, and they have to be processed rigorously, without any guessing and auto-completion.