Skip to content

The CommandLineUtils.translateCommandline fails to parse inner qoutes #33

Open
@KIC

Description

@KIC

Here is a small failing test case using spock:

import org.codehaus.plexus.util.cli.CommandLineUtils
import spock.lang.Specification

class CommandlineCommandTest extends Specification {

    def "test getCommand"() {
        given:
        def command = CommandLineUtils.translateCommandline('exec -s something -e "lala \"lo lo\" lulu" -f $file')

        when:
        def parts = command

        then:
        parts.each {println(it)}
        parts == ["exec", "-s", "something", "-e", "lala \"lo lo\" lulu", "-f", "the.file"]
    }

}

it prints

exec
-s
something
-e
lala lo
lo lulu
-f
$file

while we expect lala "lo lo" lulu to be one string

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions