-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Properly split and handle arguments in CommandHandler #414
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
Conversation
jsmnbom
left a comment
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.
Seems like the expected behaviour to me.
The only problem I could see with this is that I've seen a lot of people assume that they can get the whole argument using ' '.join(args), which no longer would be true..
jsmnbom
left a comment
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.
Please change the docstring for the pass_args argument to fit the change. Other than that, it looks good :)
|
But after this commit, one could get a "regularized" version of the original argument. |
|
Yeah that's true. Please address the docstring change I reviewed above and it looks good to go as far as I'm concerned. |
|
Noted :) |
|
I've updated the docstring in CommandHandler. |
jh0ker
left a comment
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.
LGTM 👍
Assume we got a command with more than one continuous white-space characters (which does happen) :
after
split(' '), we have['/func', '', 'arg1', 'arg2', '', 'arg3', '', '', 'arg4']which includes many unnecessary empty strings that leads to improper command handling.
This is also different from how the system handles standard
argv[].However with
split(), we have the proper parameters:['/func', 'arg1', 'arg2', 'arg3', 'arg4']Also it eliminates other unnecessary white-spaces like
\r,\n, etc.