zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: doron.behar@gmail.com
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH 1/1] Add completion for zathura.
Date: Fri, 08 Jun 2018 18:28:44 +0200	[thread overview]
Message-ID: <24170.1528475324@thecus> (raw)
In-Reply-To: <20180608155331.2891-2-doron.behar@gmail.com>

doron.behar@gmail.com wrote:

Thanks for this, I have some comments:

> +(( $+functions[_zathura_files] )) ||
> +_zathura_files(){
> +  for plugins_dir in "${opt_args[-p]}" "${opt_args[--plugins-dir]}" "/usr/lib/zathura"; do

For my installation of zathura, this finds no plugins. Perhaps they are
compiled in. It handles at least PDF and PostScript.

> +  local files_regex="*.{${supported_filetypes[1]},"
> +  for (( i = 2 ; i < ${#supported_filetypes[*]}; i ++)); do
> +    files_regex="${files_regex}""${supported_filetypes[$i]}"","
> +  done
> +  files_regex="${files_regex}""${supported_filetypes[-1]}""}"
> +  _files -g "${files_regex}"

I think this can be simplified to avoid the loop when constructing the
file glob:
  "*.(${(j.|.)supported_filetypes})(-.)"

> +
> +_arguments \
> +  {-e,--reparent=}'[Reparents to window specified by xid]:XID: ' \

As with your previous function, please stick to conventions on case for
descriptions: don't use uppercase for the first word. And don't put the
headings (like XID, PATH, NUMBER, PASSWORD) in block capitals.

X IDs are completed by _x_window.


> +  {-c,--config-dir=}'[Path to the config directory]:PATH:{_files -/}' \
> +  {-d,--data-dir=}'[Path to the data directory]:PATH:{_files -/}' \
> +  {-p,--plugins-dir=}'[Path to the directory containing plugins]:PATH:{_files -/}' \
> +  {-w,--password=}"[The document's password]:PASSWORD: " \
> +  {-P,--page=}'[Opens the document at the given page number]:NUMBER: ' \
> +  {-l,--log-level=}'[Set log level]:LEVEL:(debug, info, warning, error)' \

Remove the commas in the list. It is a space separated list when you
specify multiple options like that.

> +  {-x,--synctex-editor-command=}'[Set the synctex editor command]:COMMAND:_command' \

_command is the completer for the command reserved word so is not
applicable here. You probably want either _command_names -e or
_cmdstring.

Oliver


  reply	other threads:[~2018-06-08 16:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-08 15:53 [PATCH 0/1] *** Add completion for zathura *** doron.behar
2018-06-08 15:53 ` [PATCH 1/1] Add completion for zathura doron.behar
2018-06-08 16:28   ` Oliver Kiddle [this message]
2018-06-09 17:35     ` Doron Behar
2018-06-12 12:46       ` Oliver Kiddle
2018-06-08 16:36   ` Daniel Shahaf
2018-06-08 17:01     ` Bart Schaefer
2018-06-09 17:03       ` 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=24170.1528475324@thecus \
    --to=okiddle@yahoo.co.uk \
    --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).