Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: minimal dropbox command line completion
- X-seq: zsh-workers 47350
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH: minimal dropbox command line completion
- Date: Sat, 29 Aug 2020 14:49:56 +0100
- Archived-at: <https://zsh.org/workers/47350>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-08/ebba69f858a2ee55a3e0c6ba42ece9f285e4618a.camel%40ntlworld.com>
- Authentication-results: zsh.org; iprev=pass (know-smtprelay-omc-6.server.virginmedia.net) smtp.remote-ip=80.0.253.70; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=skipped; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1598708996; bh=LjgrqsZN9NwKOIW4upMOsrqHDG7KUqjoYhX3SD7iAjs=; h=Subject:From:To:Date:In-Reply-To:References; b=WpeqKDksy8Xl2EBEBmG8voUd+Ae0C9813ZGDUQCaUYUxQjYGacbYzgFq3uciRMpoX /9Nv444TouPUJgCWEQHBnsz9ivHsmW6miyJf63HdzBCcsSXOeeLxUf6lrkMsumg8XM j4YO2wKwRtVSB2ajy9Ip+SpRZTeIgntHQBA4ZAOZhdp+RXiypGuQJq6mZ06+DXfJsd jI+MWJwL6z0cTc9YTjYwfeO6MJaANGKkjrSw8RBQGKlit6WbbfRf8Rwkod4mP8A7DP x/kOCplh7qvzMdrQTGx7XRnJ9coEDtjGYo24qQK4wj7hx/b5RUNW68rFNmmtSY5IOa hHkSDKNCV9dcg==
- In-reply-to: <61559-1598701545.540695@NVxH.JTOI.LNn_>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <ee24c5f032cd407c4677b670fc297f7152868ed8.camel@ntlworld.com> <20200828022232.0914170c@tarpaulin.shahaf.local2> <842686448.1489803.1598603222115@mail2.virginmedia.com> <20200829003857.0a14a362@tarpaulin.shahaf.local2> <61559-1598701545.540695@NVxH.JTOI.LNn_>
- Sender: zsh-workers-request@xxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author