-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix OptionParser to handle sub-commands with hyphen #9465
Fix OptionParser to handle sub-commands with hyphen #9465
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks good to me. Any help required to get this Patch merged?
I also faced the same issue and sent patch #9481 Abandoned it after noticing this patch.
I'm not sure what is the process to get reviewed and / or merged. |
Based on the file history including @RX14 for review. Thanks. |
This should better use |
@straight-shoota I didn't know about this, it seems you're right: https://guides.rubyonrails.org/security.html#regular-expressions. I fixed it, thanks. I didn't write test for it because I am wondering what we should expect when someone puts a newline in a flag. |
It should be lower-case |
It was matching regexs anywhere on the string, but we want the regexs to match the full string. In particular this behavior made that a flag `sub-command` was interpeted as `su`, because it matches the `-(.)\S+` regex.
Indeed, from ruby doc:
|
It was matching regexs anywhere on the string, but we want the regexs to
match the full string. In particular this behavior made that a flag
sub-command
was interpeted assu
, because it matches the-(.)\S+
regex.