Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Add completion for zathura.
On Fri, Jul 13, 2018 at 11:55:09AM -0500, dana wrote:
> On 13 Jul 2018, at 07:29, Doron Behar <doron.behar@xxxxxxxxx> wrote:
> >How quoting `opt_args` and use `(Q)` will be better as for this issue?
>
> The values in opt_args are quoted exactly as they were received from the command
> line. So if the user does `zathura -p '/path/to/some/'"file"`, you will receive
> it exactly like that, with both sets of quotes, in opt_args. Therefore, if you
> don't use (Q), your checks may fail when they would otherwise succeed, since
> they're trying to match a path containing literal quotes.
>
> There's probably an even better way to do this, but this is what comes to mind:
>
> for plugins_dir in \
> ${(Qv)opt_args[(i)-p|--plugins-dir]}(#qN) \
> {/usr/local,/usr,}/lib/zathura(#qN)
> do
> plugins_files=( $plugins_dir/*.so )
> (( $#plugins_files )) && break
> done
Works like a charm. I'll be sending a complete revised patch shortly.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author