From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: minimal dropbox command line completion
Date: Sat, 29 Aug 2020 14:49:56 +0100 [thread overview]
Message-ID: <ebba69f858a2ee55a3e0c6ba42ece9f285e4618a.camel@ntlworld.com> (raw)
In-Reply-To: <61559-1598701545.540695@NVxH.JTOI.LNn_>
I've written a slightly less minimal completion from scratch.
My eyes may have glazed over on some of the instructions, but I think
I've got most points.
pws
#compdef dropbox
if [[ CURRENT -eq 2 || $words[2] = help ]]; then
local -a line progs
_call_program command dropbox help |
while read -A line; do
if [[ $line[1] = [a-z]## ]]; then
progs+=("${line[1]}:${line[2,-1]}")
fi
done
_describe -t command 'Dropbox command' progs
else
local -a opts
case $words[2] in
(exclude)
_path_files -g '*(/)'
;;
(filestatus)
shift words
(( CURRENT-- ))
_arguments -s : \
'(-l --list)'{-l,--list}'[use format like ls]' \
'(-a --all)'{-a,--all}'[do not ignore entries starting .]' \
'*:file to list:_files'
;;
(ls|puburl|sharelink)
_files
;;
(autostart|lansync)
opts=("y:turn $words[2] on" "n:turn $words[2] off")
_describe "$words[2] behaviour" opts
;;
(proxy)
_arguments \
'2:proxy mode:(none auto manual)' \
'3:proxy type for manual mode:(http socks4 socks5)' \
'4:proxy host for manual mode:_hosts' \
'5:proxy port for manual mode:_ports' \
'6:proxy user for manual mode:_users' \
'7:proxy password for manual mode:'
;;
(start)
shift words
(( CURRENT -- ))
_arguments -s : '(-i --install)'{-i,--install}'[auto install dropboxd]'
;;
(throttle)
_arguments \
'2:download limit in KB/s:(unlimited)' \
'3:upload limit in KB/s:(unlimited)'
;;
(*)
_default
;;
esac
fi
next prev parent reply other threads:[~2020-08-29 13:50 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
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 [this message]
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=ebba69f858a2ee55a3e0c6ba42ece9f285e4618a.camel@ntlworld.com \
--to=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).