go-shellwords icon indicating copy to clipboard operation
go-shellwords copied to clipboard

Parsing parens should not always throw `invalid command line string` error

Open laurazard opened this issue 2 years ago • 1 comments

It's not uncommon, in certain scenarios, to use parens inside args.

An example can be seen in the Traefik docs here (click CLI and look at the example), where it's expected that, to set a specific value, the arg --providers.docker.constraints=Label('a.label.name','foo') be used.

With the current implementation of go-shellwords, parsing a string including an arg like that throws an error, even though this is a valid shell-word string.

laurazard avatar Dec 22 '22 13:12 laurazard

By the way, unquoted parentheses doesn't make string an invalid bash command example:

#> $(which ls)
toto.rb                     bob                      toto.tar                     compose.yml
#> (which ls)
/bin/ls

ndeloof avatar Dec 23 '22 13:12 ndeloof