Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: update a few completion functions
- X-seq: zsh-workers 21380
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: update a few completion functions
- Date: Fri, 24 Jun 2005 16:43:20 +0200
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This updates _wget for wget 1.10 and improves the iwconfig, mii-tool and
tune2fs completions. Be careful when using _values within _arguments. It
needs a description as it's first argument and any colons need to be
quoted to hide them from _arguments.
Oliver
Index: Completion/Linux/Command/_iwconfig
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_iwconfig,v
retrieving revision 1.1
diff -u -r1.1 _iwconfig
--- Completion/Linux/Command/_iwconfig 7 Mar 2005 18:59:43 -0000 1.1
+++ Completion/Linux/Command/_iwconfig 24 Jun 2005 14:38:32 -0000
@@ -1,29 +1,68 @@
#compdef iwconfig
-local iwparams prevword expl
+local curcontext="$curcontext" state line expl ret=1
-iwparams=(
-essid nwid freq channel sens mode ap nick rate rts frag txpower enc
-key power retry
-)
+_arguments -C \
+ '(1 * -)--help[display help information]' \
+ '(1 * -)--version[display version information]' \
+ '1:network interface:_net_interfaces' \
+ '*:parameter:->parameters' && ret=0
-if (( CURRENT == 2 )); then
- _net_interfaces || compadd -- --help --version
- return
-fi
-
-prevword="$words[CURRENT-1]"
+if [[ -n "$state" ]]; then
+ local -a arg
-if [[ -n ${iwparams[(r)$prevword]} ]]; then
- case "$prevword" in
- (mode)
- _wanted tag expl 'operating mode' \
- compadd Ad-Hoc Managed Master Repeater Secondary Monitor Auto
+ case $words[CURRENT-1] in
+ essid) _wanted -x names expl 'network name' compadd off any on ;;
+ nwid|domain) _message -e ids 'network id' ;;
+ freq|channel) _message -e channels 'channel or frequency' ;;
+ sens) _message -e levels 'signal level' ;;
+ mode)
+ _wanted modes expl 'operating mode' compadd \
+ Ad-Hoc Managed Master Repeater Secondary Monitor Auto
+ ;;
+ ap) _message -e access-points 'access point' ;;
+ nick*) _message -e names 'nickname' ;;
+ rate|bit*) _message -e bit-rates 'bit rate' ;;
+ rts*|frag*) _message -e sizes 'size' ;;
+ key|enc*) _message -e keys 'key' ;;
+ power)
+ arg=(
+ \*{min,max}'[modifier]'
+ '*off[disable power management]'
+ '*on[enable power management]'
+ '*all[receive all packets]'
+ 'unicast[receive unicast packets only]'
+ 'multicast[receive multicast and broadcast packets only]'
+ )
+ ;&
+ min|max)
+ _values -S ' ' -w 'parameter' \
+ 'period[set the period between wake ups]' \
+ 'timeout[set timeout before sleep]' \
+ $arg[@] && ret=0
+ ;;
+ period|timeout) _message -e timeouts 'timeout' ;;
+ txpower) _message -e power 'transmit power' ;;
+ retry) _message -e retries 'retries' ;;
+ *)
+ _values -S ' ' -w 'option' \
+ 'essid[set the network name]' \
+ '(nwid domain)'{nwid,domain}'[set the network ID]' \
+ '(freq channel)'{freq,channel}'[set the operating frequency or channel]' \
+ 'sens[set the sensitivity threhold]' \
+ 'mode[set operating mode]' \
+ 'ap[register with given access point]' \
+ '(nick nickname)'nick{,name}'[set the nickname]' \
+ '(rate bit)'{rate,bit}'[set the bitrate]' \
+ 'rts[set packet size threshold for sending RTS]' \
+ 'frag[set maximum packet fragment size]' \
+ \*{key,enc}'[add encryption key]' \
+ '*power[manipulate power management scheme parameters]' \
+ 'txpower[set transmit power]' \
+ 'retry[set number of retries]' \
+ 'commit[apply changes imediately]' && ret=0
;;
- (*)
- _wanted tag expl "$prevword value" \
- compadd off
esac
-else
- _wanted tag expl 'iwconfig parameter' compadd $iwparams commit
fi
+
+return ret
Index: Completion/Linux/Command/_mii-tool
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_mii-tool,v
retrieving revision 1.1
diff -u -r1.1 _mii-tool
--- Completion/Linux/Command/_mii-tool 7 Mar 2005 03:13:49 -0000 1.1
+++ Completion/Linux/Command/_mii-tool 24 Jun 2005 14:38:32 -0000
@@ -1,12 +1,12 @@
#compdef mii-tool
-_arguments \
- '(-V --version)'{-V,--version}'[version]' \
- '(-v --verbose)'{-v,--verbose}'[verbose]' \
+_arguments -s \
+ '(-V --version)'{-V,--version}'[display version information]' \
+ '(-v --verbose)'{-v,--verbose}'[verbose output]' \
'(-R --reset)'{-R,--reset}'[reset MII to poweron state]' \
'(-r --restart)'{-r,--restart}'[restart autonegotiation]' \
'(-w --watch)'{-w,--watch}'[monitor for link status changes]' \
'(-l --log)'{-l,--log}'[write events to syslog]' \
- '(-A --advertise)'{-A,--advertise=}'[advertise only specified media]:media:_values -s , 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT' \
+ '(-A --advertise)'{-A,--advertise=}'[advertise only specified media]:medium:_values -s , medium 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT' \
'(-F --force)'{-F,--force=}'[force specified medium]:medium:(100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT)' \
'*:interface:_net_interfaces'
Index: Completion/Linux/Command/_tune2fs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_tune2fs,v
retrieving revision 1.1
diff -u -r1.1 _tune2fs
--- Completion/Linux/Command/_tune2fs 7 Mar 2005 03:21:47 -0000 1.1
+++ Completion/Linux/Command/_tune2fs 24 Jun 2005 14:38:32 -0000
@@ -1,22 +1,22 @@
#compdef tune2fs
_arguments \
- '-c[max mount count]:number of times:' \
- '-C[set mount count]:number of times:' \
+ '-c[set max mounts between checks]:number of mounts' \
+ '-C[set mount count]:number of mounts' \
'-e[set error behavior]:error behavior:(continue remount-ro panic)' \
'-f[force tune2fs to complete even in the face of errors]' \
'-g[set the group which can use reserved filesystem blocks]:group:_groups' \
'-i[interval between checks]:duration:' \
'-j[add an ext3 journal to the filesystem]' \
- '-J[journal options]:options:_values -s , size:size: device:blockdevice:_files' \
+ '-J[journal options]: :_values -s , option "size[specify journal size]\:size" "device[use external journal]\:block device\:_files"' \
'-l[list the contents of the filesystem superblock]' \
'-L[set the volume label of the filesystem]:label:' \
'-m[set the percentage of reserved filesystem blocks]:percentage:' \
'-M[set the last-mounted directory for the filesystem]:directory:_files -/' \
'-o[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback' \
- '-O[filesystem features]:features:_values -s , dir_index filetype has_journal sparse_super' \
+ '-O[set or clear filesystem features]: :_values -s , feature dir_index filetype has_journal sparse_super' \
'-r[set the number of reserved filesystem blocks]:number:' \
- '-s[set sparse super feature]:on or off:(0 1)' \
+ '-s[set sparse super feature]:state:((0\:off 1\:on))' \
'-T[set time last checked]:time specifier:' \
'-u[set user who can use reserved filesystem blocks]:user:_users' \
'-U[set filesystem UUID]:UUID or special:(clear random time)' \
Index: Completion/Unix/Command/_wget
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_wget,v
retrieving revision 1.10
diff -u -r1.10 _wget
--- Completion/Unix/Command/_wget 24 Jun 2005 12:44:00 -0000 1.10
+++ Completion/Unix/Command/_wget 24 Jun 2005 14:38:32 -0000
@@ -4,15 +4,15 @@
typeset -A opt_args
_arguments -C -s \
- '(--version -V)'{--version,-V}'[display version info]' \
- '(--help -h)'{--help,-h}'[display help]' \
+ '(- *)'{--version,-V}'[display version info]' \
+ '(- *)'{--help,-h}'[display help]' \
'(--background -b)'{--background,-b}'[run in background]' \
'(--execute -e)'{--execute=,-e+}'[execute .wgetrc command]:.wgetrc command' \
'(--output-file -o --append-output -a)'{--output-file=,-o+}'[specify output logfile]:log file to output:_files' \
'(--append-output -a --output-file -o)'{--append-output=,-a+}'[specify output logfile to append to]:log file to append:_files' \
'(--debug -d)'{--debug,-d}'[turn on debug output]' \
- '(--quiet -q --verbose -v --non-verbose -nv)'{--quiet,-q}'[turn off output]' \
- '(--quiet -q --verbose -v --non-verbose -nv)'{--verbose,-v}'[turn on verbose output]' \
+ '(--quiet -q --verbose -v --no-verbose -nv)'{--quiet,-q}'[turn off output]' \
+ '(--quiet -q --verbose -v --no-verbose -nv)'{--verbose,-v}'[turn on verbose output]' \
'*-n+[turn off flags]:flags:->noflags' \
'(--input-file -i)'{--input-file=,-i+}'[specify input file]:file containing URLs:_files' \
'(--force-html -F)'{--force-html,-F}'[treat input file as html]' \
@@ -29,31 +29,60 @@
'(--timeout -T)--dns-timeout=[set the DNS lookup timeout]:DNS lookup timeout (seconds)' \
'(--timeout -T)--connect-timeout=[set the connect timeout]:connect timeout (seconds)' \
'(--timeout -T)--read-timeout=[set the read timeout]:read timeout (seconds)' \
- '(--wait,-w)'{--wait=,-w+}'[specify wait between retrievals]:wait between retrievals (seconds)' \
- '(--random-wait)--waitretry=:wait between retries of a retrieval (seconds)' \
- '(--waitretry)--random-wait[wait from 0...2*WAIT secs between retrievals]' \
- '(--proxy -Y)'{--proxy=,-Y+}'[turn proxy on or off]:proxy use:(on off)' \
+ '(--wait,-w)'{--wait=,-w+}'[specify wait between retrievals]:time (seconds)' \
+ '(--random-wait)--waitretry=:time (seconds)' \
+ '(--waitretry)--random-wait[random wait time between retrievals]' \
+ '(--proxy -Y --no-proxy)'{--proxy=,-Y+}'[explicitly turn on proxy]' \
+ '(--proxy -Y --no-proxy)--no-proxy[explicitly turn off proxy]' \
'(--quota -Q)'{--quota=,-Q+}'[set retrieval quota]:number' \
'--bind-address=:address to bind to (hostname or IP):_hosts' \
'--limit-rate=[specify limit to download rate]:download rate limit' \
- '--dns-cache=[disable caching DNS lookups]:dns cache:(on off)' \
+ '--no-dns-cache[disable caching DNS lookups]' \
'--restrict-file-names=[restrict chars in file names to ones OS allows]:OS:->restrict' \
+ '(-4 --inet4-only -6 --inet6-only)'{-4,--inet4-only}'[connect only to IPv4 addresses]' \
+ '(-4 --inet4-only -6 --inet6-only)'{-6,--inet6-only}'[connect only to IPv6 addresses]' \
+ '--prefer-family[connect first to addresses of specified family]:address family:(IPv6 IPv4 none)' \
+ '(--http-user --ftp-user)--user[set both ftp and http user]:user' \
+ '(--http-password --ftp-password)--password[set both ftp and http password]:password' \
'(--force-directories -x)'{--force-directories,-x}'[force creation of directories]' \
+ '--protocol-directories[use protocol name in directories]' \
'(--directory-prefix -P)'{--directory-prefix=,-P+}'[specify prefix to save files to]:prefix:_files -/' \
'--cut-dirs=:number:' \
- '--http-user=:user:' \
- '--http-passwd=:password:' \
- '(--html-extension -E)'{--html-extension,-E}'[save all text/html files with a .html extension]' \
+ '(--user)--http-user=:user' \
+ '(--password)--http-password=:password' \
+ '--no-cache[disallow server-cached data]' \
+ '(--html-extension -E)'{--html-extension,-E}'[save all HTML documents with a .html extension]' \
"--ignore-length[ignore \`Content-Length' header field]" \
- '--header=:string:' \
- '--proxy-user=:user:' \
- '--proxy-passwd=:password:' \
+ '--header=:string' \
+ '--proxy-user=:user' \
+ '--proxy-password=:password' \
'--referer=:URL:_urls' \
- '(--save-headers -s)'{--save-headers,-s}'[save http headers]' \
+ '--save-headers[save http headers]' \
'(--user-agent -U)'{--user-agent=,-U+}'[specify user agent to identify as]:user-agent' \
+ '--no-http-keep-alive[disable HTTP keep-alive]' \
+ '--no-cookies=[turn cookies off]' \
+ '--load-cookies=[specify file to load cookies from]:cookie file:_files' \
+ '--save-cookies=[specify file to save cookies to]:cookie file:_files' \
+ '--keep-session-cookies[load and save session cookies]' \
+ '--post-data=[use the POST method with specified data]:data to send' \
+ '--post-file=[use the POST method; sending contents of a file]:file:_files' \
+ '--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1)' \
+ "--no-check-certificate=[don't check the server certificate]" \
+ '--certificate=[specify client certificate]:client certificate file:_files' \
+ '--certificate-type=[specify client certificate type]:certificate type:(PEM DER)' \
+ '--private-key=[specify private key file]:key file:_files' \
+ '--private-key-type=[specify private key type]:key type:key type:(PEM DER)' \
+ "--ca-certificate=[specify file with bundle of CA's]:file:_files" \
+ "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \
+ '--random-file[specify file with random data for seeding generator]:file:_files' \
+ '--egd-file=[specify filename of EGD socket]:file:_files' \
+ '(--user)--ftp-user=:user' \
+ '(--password)--ftp-password=:password' \
+ "--no-remove-listing[don't remove \`.listing' files]" \
+ '--no-glob[turn off FTP file name globbing.]' \
+ '--no-passive-ftp' \
'--retr-symlinks' \
- '(--glob -g)'{--glob=,-g+}'[turn file globbing on or off]:glob:(on off)' \
- '--passive-ftp' \
+ '--preserve-permissions[preserve remote file permissions with ftp]' \
'(--recursive -r)'{--recursive,-r}'[recurse subdirectories]' \
'(--level -l)'{--level=,-l+}'[specify maximum recursion depth]:level' \
'--delete-after' \
@@ -64,39 +93,23 @@
'--strict-comments[turn on strict (SGML) handling of HTML comments]' \
'(--accept -A)'{--accept=,-A+}'[specify accepted extensions]:extensions' \
'(--reject -R)'{--reject=,-R+}'[specify rejected extensions]:extensions' \
- '(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains' \
- '--exclude-domains=:rejected domains:' \
+ '(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains:_domains' \
+ '--exclude-domains=:rejected domains:_domains' \
'--follow-ftp' \
'--follow-tags=:HTML tags:' \
- '(--ignore-tags -G)'{--ignore-tags=,-G+}'[specify ignored HTML tags]:HTML tags' \
+ '--ignore-tags=[specify ignored HTML tags]:HTML tags' \
'(--span-hosts -H)'{--span-hosts,-H}'[span hosts]' \
'(--relative -L)'{--relative,-L}'[follow relative links only]' \
'(--include-directories -I)'{--include-directories=,-I+}'[include directories]:allowed directories' \
'(--exclude-directories -X)'{--exclude-directories=,-X+}'[exclude directories]:excluded directories' \
'--no-host-lookup' \
'--no-parent' \
- '--non-verbose' \
+ '--no-verbose' \
'--no-clobber' \
'--no-directories' \
'--no-host-directories' \
- '--dont-remove-listing' \
- '(--cache -C)'{--cache=,-C+}'[(dis)allow server-cached data]:cache:(on off)' \
'--htmlify=:htmlify:' \
'--no:no:->noflags' \
- '--cookies=[turn cookies on or off]:cookies:(on off)' \
- '--load-cookies=[specify file to load cookies from]:cookie file:_files' \
- '--save-cookies=[specify file to save cookies to]:cookie file:_files' \
- '--post-data=[use the POST method with specified data]:data to send' \
- '--post-file=[use the POST method; sending contents of a file]:file:_files' \
- '--no-http-keep-alive[disable HTTP keep-alive]' \
- '--sslcertfile=[specify client certificate]:client certificate file:_files' \
- '--sslcertkey=[specify keyfile for certificate]:keyfile:_files' \
- '--egd-file=[specify filename of EGD socket]' \
- "--sslcadir=[specify dir where hash list of CA's are stored]:directory:_directories" \
- "--sslcafile=[specify file with bundle of CA's]:file:_files" \
- '--sslcerttype=[specify client cert type]:certificate type:((0\:PEM 1\:ASN1))' \
- '--sslcheckcert=[check the server cert against given CA]: :(0 1)' \
- '--sslprotocol=[choose SSL protocol]:protocol version:((0\:automatic 1\:SSLv2 2\:SSLv3 3\:TLSv1))' \
'*:URL:_urls' && return 0
case "$state" in
@@ -111,7 +124,6 @@
'H[no host directories]' \
'd[no directories]' \
'c[no clobber]' \
- 'r[don'\''t remove listing]' \
'p[no parent]'
;;
restrict)
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author