-
Notifications
You must be signed in to change notification settings - Fork 119
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
yargs not passing string correctly #93
Comments
@hisabimbola good catch; looks like somewhere in the parsing process we drop the |
@hisabimbola @antoniom unfortunately, I thought of a couple edge-cases where the logic for handling quoted strings would break the parse. Specifically if you had a boolean argument configured, followed by a string:
I think we should leave this behavior as is, i.e., eating node test.js -f "world-hello" will result in the following [ '/Users/benjamincoe/.nvm/versions/node/v7.1.0/bin/node',
'/Users/benjamincoe/bcoe/yargs/test.js',
'-f',
'world-hello' ] so even if we do add this parsing feature to perhaps start a conversation in our community slack and we can discuss other potential solutions to the problem -- perhaps you could JSON encode the data being passed in? |
@bcoe Since this is the default behavior from OS side, its OK for me. Feel free to revert it. |
Passing an undefined variable as TypeError: Cannot read property 'match' of undefined |
@ilatypov 👍 yeah, would appreciate it if you create an issue specifically related to this. |
@bcoe Can I please ask you to again have a look at the case for allowing strings with quotes to be passed? It becomes very important to have it when string with spaces need to be passed. Consider this scenario If I don't use double-quotes with my string, then the OS itself will consider the first word as the argument value. But it doesn't strips them out itself. This comment explains it better. I completely understand your concern when random string is passed after boolean arguments. But I guess passing string with spaces is a very common case too. And if possible, if the option has type specified as |
@malhotraashna please open a new issue with an example of a reproduction in test if possible. |
This test fails on this module. Not sure how to fix it.
The text was updated successfully, but these errors were encountered: