Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

_call_program (and possibly other hooks) or opt_args quoting prob lem.



_call_program evals its argument(s). It creates very interesting problem -
we want to quote word separator _but_ we do not want to quote possible
parameter expansions ... to illustrate:

trying to complete

info -d $PWD/a\ b TAB

you either do not quote value of option -d, getting

+_call_program:12> eval info -d $PWD/a b --output -

wrong because it splits filename

or you do quote value of option -d getting

+_call_program:12> eval info -d \$PWD/a\ b --output -

which is wrong as well because it does not expand $PWD.

The problem seems to actually be in how _arguments stores values of options.
It seems to remove all quotes from them, but then, we cannot quote them back
reliably. It really looks like _argument should save word(s) from command
line verbatim and left to user to decide when values need to be dequoted.

OTOH it means that user possibly must pass values via eval every time ...
horrors. Just assume we need real directory name ... [ -d ${opt_args[-d]} ]
would be totally wrong.

-andrej



Messages sorted by: Reverse Date, Date, Thread, Author