[ 
https://issues.apache.org/jira/browse/GROOVY-7352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14576518#comment-14576518
 ] 

Paul King edited comment on GROOVY-7352 at 6/8/15 12:09 AM:
------------------------------------------------------------

It looks like this is by design behavior for Commons CLI: CLI-185
If I am reading it correctly, it's due to some kind of legacy windows kludge 
that has been retained for b/w compatibility reasons and currently can't be 
turned off.


was (Author: paulk):
It looks like this is by design behavior for Commons CLI:
https://issues.apache.org/jira/browse/CLI-185
If I am reading it correctly, it's due to some kind of legacy windows kludge 
that has been retained for b/w compatibility reasons and currently can't be 
turned off.

> CliBuilder kills head/tail quotes from argument
> -----------------------------------------------
>
>                 Key: GROOVY-7352
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7352
>             Project: Groovy
>          Issue Type: Bug
>          Components: command line processing
>    Affects Versions: 2.4.0
>         Environment: $ groovy -v
> Groovy Version: 2.4.0 JVM: 1.8.0_31 Vendor: Oracle Corporation OS: Linux
> apostrophes works as expected:
> $ groovy bug-paf-2.groovy -f "'test'"
> 'test'
> $ groovy bug-paf-2.groovy -f "'test"
> 'test
> $ groovy bug-paf-2.groovy -f "test'"
> test'
> (problem is only with quotes inside argument value)
> I wanted to pass json filter expression -f ".Field == \"\""
> and got last quote killed.
>            Reporter: Alexander Petrossian (PAF)
>
> {code}
> $ cat bug-paf-2.groovy
> def cli = new CliBuilder()
> cli.with {
>       f longOpt:'json-filter','jq expression', args: 1
> }
> def opt = cli.parse(args)
> print "${opt.f}\n"
> $ 
> {code}
> {noformat}
> $ groovy bug-paf-2.groovy -f '"test"'  #expected "test", got:
> test
> $ groovy bug-paf-2.groovy -f '"test'  #expected "test, got:
> test
> $ groovy bug-paf-2.groovy -f 'test"' #expected test", got:
> test
> {noformat}
> {noformat}
> $ groovy bug-paf-2.groovy -f "\"test\""  #expected "test", got:
> test
> $ groovy bug-paf-2.groovy -f "\"test"  #expected "test, got:
> test
> $ groovy bug-paf-2.groovy -f "test\"" #expected test", got:
> test
> {noformat}
> looks like somebody clears head/tail quotes.
> this must not be done.
> removing quotes/apostrophes is a task for shell, once data gets to argv, no 
> unquoting must be done on it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to