From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: minimal dropbox command line completion
Date: Fri, 28 Aug 2020 02:22:32 +0000 [thread overview]
Message-ID: <20200828022232.0914170c@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <ee24c5f032cd407c4677b670fc297f7152868ed8.camel@ntlworld.com>
Peter Stephenson wrote on Thu, 27 Aug 2020 21:15 +0100:
> +++ b/Completion/Unix/Command/_dropbox
Relation to [1]? It uses a different top-of-file directive, but
nevertheless seems to be possibly related.
[1] https://github.com/zpm-zsh/dropbox/blob/master/functions/_dropbox-cli
[2] https://github.com/ivoarch/dropbox-zsh-completion/blob/master/_dropbox
> @@ -0,0 +1,16 @@
> +#compdef dropbox
> +
> +if [[ CURRENT -eq 2 || $words[2] = help ]]; then
> + local -a line progs
> +
> + _call_program commands command dropbox help |
> + while read -A line; do
> + if [[ $line[1] = [a-z]## ]]; then
> + progs+=("$line[1]:$line[2,-1]")
Suggest s/$line[1]/${line[1]}/ for forward compatibility with
a potential future «:$» history modifier. (And -r to 'read')
> + fi
> + done
> +
> + _describe -t dropbox-commands 'Dropbox command' progs
> +elif [[ $words[2] = (ls|filestatus|sharelink) ]]; then
> + _files
else
return 1
> +fi
>
>
Aside: I wonder why we don't use a «_call_completion_function()
{ readonly -i n=$compstate[nmatches]; "$@" && (( $compstate[nmatches] > $n)) }»
wrapper around calls to $_comps[foo]: that'd save every single
completion function having to manage $ret explicitly.)
Cheers,
Daniel
next prev parent reply other threads:[~2020-08-28 2:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-27 20:15 Peter Stephenson
2020-08-28 2:22 ` Daniel Shahaf [this message]
2020-08-28 8:27 ` Peter Stephenson
2020-08-29 0:38 ` Daniel Shahaf
2020-08-29 11:45 ` Oliver Kiddle
2020-08-29 13:49 ` Peter Stephenson
2020-08-29 19:58 ` PATCH: minimal dropbox command line completion (and $compstate[nmatches]/$ret) Daniel Shahaf
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=20200828022232.0914170c@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=p.w.stephenson@ntlworld.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).