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

Re: [PATCH] Add completion for zathura.



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

On 13 Jul 2018, at 07:29, Doron Behar <doron.behar@xxxxxxxxx> wrote:
>These are the options' descriptions I've ended up with:

Looks better to my eye

dana



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