plexus-utils
plexus-utils copied to clipboard
The CommandLineUtils.translateCommandline fails to parse inner qoutes
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