Open alexherbo2 opened 4 years ago
Your -quoting raw
is evaluate-commands -verbatim
and -quoting kakoune
is the default.
The JSON one is interesting because it makes word boundaries very explicit. I wonder what's the use case.
evaluate-commands -quoting shell %sh{ printf '"echo" "Tchou"' }
Shell expansion seems out of scope for evaluate-commands
(should it expand $()
as well?).
It can be done in the sh
block, although it's not very nice.
evaluate-commands %sh{
kakquote() { printf "%s" "$*" | sed "s/'/''/g; 1s/^/'/; \$s/\$/'/"; }
shell_quoted_command=$(printf '"echo" "Tchou"')
eval set -- "$shell_quoted_command"
for arg
do
kakquote "$arg"
printf ' '
done
}
Some programs easily output shell quoted arguments, I assume we should not re-evaluate the resulting string (your $(...)
comment).
Raw
Error
Kakoune
Shell
JSON