Skip to content
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

Windows CLI does not accept single quote as string delimiter #1291

Closed
sjfink opened this issue Sep 20, 2016 · 3 comments
Closed

Windows CLI does not accept single quote as string delimiter #1291

sjfink opened this issue Sep 20, 2016 · 3 comments

Comments

@sjfink
Copy link
Contributor

sjfink commented Sep 20, 2016

I'm creating Actions on OpenWhisk via Windows CLI. When a string is passed with single quotes, the quotes are ignored and as delimiter and treated as part of the string. If a string has a blank, then it sees as two different values and so an error occurs.

When I use double quotes, it works fine.

Linux CLI is working fine.

C:\Users\IBM_ADMIN\Desktop\OpenStack Files\Uses Case>wsk action invoke --blocking --result hello --param name 'Bernie' --param place 'Vermont'
{
"payload": "Hello, 'Bernie' from 'Vermont'"
}

C:\Users\IBM_ADMIN\Desktop\OpenStack Files\Uses Case>wsk action invoke --blocking --result hello --param name 'Bernie Sanders' --param place 'Vermont'
error: Invalid argument(s): Sanders'.
Run 'wsk --help' for usage.

C:\Users\IBM_ADMIN\Desktop\OpenStack Files\Uses Case>wsk action invoke --blocking --result hello --param name 'Bernie_Sanders' --param place 'Vermont'
{
"payload": "Hello, 'Bernie_Sanders' from 'Vermont'"
}

C:\Users\IBM_ADMIN\Desktop\OpenStack Files\Uses Case>wsk action invoke --blocking --result hello --param name "Bernie Sanders" --param place 'Vermont'
{
"payload": "Hello, Bernie Sanders from 'Vermont'"
}

@csantanapr
Copy link
Member

@dubeejw do you have any insight on dealing with single quotes using the CLI on windows

@csantanapr
Copy link
Member

I think we should doc the samples using double quotes until we find a solution.

@mdeuser
Copy link
Contributor

mdeuser commented Oct 12, 2016

This behavior is due to the Windows cmd command processor. Single quotes are not treated like double quotes, but are instead treated pretty much like any other character. So, on Windows systems, arguments requiring quoting should use double quotes.
http://stackoverflow.com/questions/24173825/what-does-single-quote-do-in-windows-batch-files

You can also validate this with a simple echoargs.bat file

@echo %0
@echo %1
@echo %2
@echo %3
>echoargs '1 2 3'
echoargs
`1
2
3`
>echoargs "1 2 3"
echoargs
"1 2 3"
ECHO is on.
ECHO is on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants