steeloverseer icon indicating copy to clipboard operation
steeloverseer copied to clipboard

Commands with quotes fail to parse

Open michalrus opened this issue 7 years ago • 3 comments

On 85d40083ac893bebc3696ab48f223da8af928874, e.g.:

$ echo "cabal test --test-options='1234'\\'' 567'"
cabal test --test-options='1234'\'' 567'

$ sos . -c "cabal test --test-options='1234'\\'' 567'"
sos: Error parsing command 'cabal test --test-options='1234'\'' 567''

(1)$ 

michalrus avatar Dec 29 '17 16:12 michalrus

@michalrus what's the use case here?

schell avatar Dec 29 '17 17:12 schell

@schell, say, if I wanted to match a Tasty test case with a space in name, I’d need that. The pure Cabal command would then be:

cabal test --test-options='-p '\''some test name w/ spaces'\'' --color=always'

Currently there’s no way to pass that command to sos -c [ … here … ].

michalrus avatar Dec 30 '17 13:12 michalrus

Yes, I see. The difficulty here is that within a command we use \ as the leader to a capture group. It's possible we simply need some logic around that to check for quotes, as that is obviously not a valid capture group.

I'll get this when I can but until then I welcome any pull request, @michalrus! Here's where the logic should probably go: https://github.com/schell/steeloverseer/blob/master/src/Sos/Template.hs#L41

schell avatar Jan 04 '18 00:01 schell