case-app icon indicating copy to clipboard operation
case-app copied to clipboard

Completions that contain single quotes are broken in zsh

Open Jasper-M opened this issue 2 years ago • 1 comments

$ scala-cli e
(eval):5: unmatched '
(eval):5: unmatched '
(eval):5: unmatched '

The problem seems to be with those escaped ' characters:

$ scala-cli complete zsh-v1 "1" "e"
local -a args306746944
args306746944=(
'export:The \'export\' sub-command is experimental.'
)
_describe command args306746944

Without the backslashes the completions work, but the quotes simply aren't printed. I'm not sure if there's any way to output single quotes succesfully...

Jasper-M avatar May 15 '23 13:05 Jasper-M

This seems to be a problem for arguments only. Not for options (args that start with -). For some reason options are put between double quotes and there the \' doesn't cause issues:

$ scala-cli complete zsh-v1 2 scala-cli --java-prop-o
local -a args1160121317
args1160121317=(
"--java-prop-option:Add java properties. Note that options equal \`-Dproperty=value\` are assumed to be java properties and don\'t require to be passed after \`--java-prop\`."
"--java-prop-option:Add java properties. Note that options equal \`-Dproperty=value\` are assumed to be java properties and don\'t require to be passed after \`--java-prop\`."
)
_describe command args1160121317

Notice the don\'t .

So I guess the fix may be as simple as always using double quotes. But then I don't know why options and arguments were handled differently to begin with.

Jasper-M avatar May 15 '23 14:05 Jasper-M