zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Doron Behar <doron.behar@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] Add completion for zathura.
Date: Fri, 13 Jul 2018 11:55:09 -0500	[thread overview]
Message-ID: <E9A37F8F-1F1E-4E10-A6A9-E64FB3399E68@dana.is> (raw)
In-Reply-To: <20180713122909.o5rpg6ocoigx6sv3@NUC.doronbehar.com>

On 13 Jul 2018, at 07:29, Doron Behar <doron.behar@gmail.com> 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@gmail.com> wrote:
>These are the options' descriptions I've ended up with:

Looks better to my eye

dana


  reply	other threads:[~2018-07-14  9:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 16:31 doron.behar
2018-07-01 17:11 ` Doron Behar
2018-07-01 19:06   ` dana
2018-07-13 12:29     ` Doron Behar
2018-07-13 16:55       ` dana [this message]
2018-07-13 19:53         ` Doron Behar
2018-07-13 19:52 doron.behar
2018-07-16 17:24 ` Doron Behar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E9A37F8F-1F1E-4E10-A6A9-E64FB3399E68@dana.is \
    --to=dana@dana.is \
    --cc=doron.behar@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).