* PATCH: new and updated completions
@ 2001-08-06 14:28 Oliver Kiddle
2001-08-06 14:30 ` Chmouel Boudjnah
2001-08-07 10:36 ` Sven Wischnowsky
0 siblings, 2 replies; 14+ messages in thread
From: Oliver Kiddle @ 2001-08-06 14:28 UTC (permalink / raw)
To: zsh-workers
This makes a number of changes to completion functions.
The -j option to cvs checkout was duplicated.
_user_admin is new and is for the various useradd, groupmod etc
commands. It should work for Solaris and Linux. RedHat/Mandrake add a
couple of options to deal with their stupid single user groups so if
anyone can think of a good way to detect RedHat/Mandrake, please let me
know? Also, please let me know if you have a better idea for this
function's name or think it should be split up?
I'll apply the above to both branches and the following only to the
development branch unless anyone suggests otherwise.
I've rewritten _dd to use _values. It highlights a bug/limitation of
_values: it continues to offer options which have already been
specified as if they were preceded by `*' in the spec. It wouldn't do
this if, for example, the values were comma separated.
I've also made a start of updating functions to make better use of the
grouping of options with the same description. I've changed dict, GNU
diff, GNU grep, loadkeys, GNU ls, GNU patch and wget. Things don't seem
to work perfectly if I type grep --<tab> - the list is messed up but is
fine after grep -<tab>.
Oliver
Index: Completion/Unix/Command/_cvs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_cvs,v
retrieving revision 1.7
diff -u -r1.7 _cvs
--- Completion/Unix/Command/_cvs 2001/07/27 11:34:46 1.7
+++ Completion/Unix/Command/_cvs 2001/08/06 14:21:11
@@ -163,7 +163,6 @@
'(-D)-r+[specify revision]:tag:_cvs_revisions' \
'(-r)-D+[specify date]:date:_cvs_D' \
'-j+[merge]:tag:_cvs_revisions' \
- '-j+[merge]:tag:_cvs_revisions' \
'*:module:_cvs_modules'
}
Index: Completion/Unix/Command/_dd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_dd,v
retrieving revision 1.1
diff -u -r1.1 _dd
--- Completion/Unix/Command/_dd 2001/04/02 11:47:45 1.1
+++ Completion/Unix/Command/_dd 2001/08/06 14:21:11
@@ -1,20 +1,14 @@
#compdef dd
-local expl
-
-if compset -P 1 'conv='; then
- # If there's a comma present, ignore up to the last one. The
- # test alone will have that effect.
- compset -p '*,'
- _wanted values expl conversion \
- compadd -qS, ascii ebcdic ibm block unblock lcase ucase swab noerror sync
-elif compset -P 1 'if='; then
- _description files expl 'input file'
- _tilde_files "$expl[@]"
-elif compset -P 1 'of='; then
- _description files expl 'output file'
- _tilde_files "$expl[@]"
-else
- _wanted values expl option \
- compadd -S '=' if of ibs obs bs cbs skip files seek count conv
-fi
+_values -S '=' 'option' \
+ 'if[specify input file]:input file:_tilde_files' \
+ 'of[specify output file]:output file:_tilde_files' \
+ 'ibs[input block size]:block size (bytes)' \
+ 'obs[output block size]:block size (bytes)' \
+ 'bs[block size]:block size (bytes)' \
+ 'cbs[conversion buffer size]:buffer size (bytes)' \
+ 'skip[input blocks initially skipped]:blocks' \
+ 'seek[output blocks initially skipped]:blocks' \
+ 'files[specify number of input files to copy and concatenate]:number of files' \
+ 'count[number of input blocks to copy]:blocks' \
+ 'conv[specify conversions to apply]:conversion:_values -s , "conversion" ascii ebcdic ibm block unblock lcase ucase swab noerror sync'
Index: Completion/Unix/Command/_dict
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_dict,v
retrieving revision 1.2
diff -u -r1.2 _dict
--- Completion/Unix/Command/_dict 2001/04/02 13:04:05 1.2
+++ Completion/Unix/Command/_dict 2001/08/06 14:21:11
@@ -1,47 +1,28 @@
#compdef dict
_arguments \
- '(--host)-h[host]:dict server:_hosts' \
- '(-h)--host:dict server:_hosts' \
- '(--port)-p[port]:service:' \
- '(-p)--port:service:' \
- '(--database)-d[database]:db name:' \
- '(-d)--database:db name:' \
- '(--match)-m[match]' \
- '(-m)--match' \
- '(--strategy)-s[strategy]:strategy:' \
- '(-s)--strategy:strategy:' \
- '(--nocorrect)-C[nocorrect]' \
- '(-C)--nocorrect' \
- '(--config)-c[config]:config file:_files' \
- '(-c)--config:config file:_files' \
- '(--dbs)-D[list dbs]' \
- '(-D)--dbs' \
- '(--strats)-S[strats]' \
- '(-S)--strats' \
- '(--serverhelp)-H[server help]' \
- '(-H)--serverhelp' \
- '(--info)-i[db info]:db name:' \
- '(-i)--info:db name:' \
- '(--noauth)-a[disable authentication]' \
- '(-a)--noauth' \
- '(--user)-u[user]:user name:' \
- '(-u)--user:user name:' \
- '(--key)-k[key]:shared secret:' \
- '(-k)--key:shared secret:' \
- '(--version)-V[display version]' \
- '(-V)--version' \
- '(--license)-L[display license]' \
- '(-L)--license' \
- '--help' \
- '(--verbose)-v[be verbose]' \
- '(-v)--verbose' \
- '(--raw)-r[be very verbose]' \
- '(-r)--raw' \
- '(--pager)-P[pager]:program:_command_names -e' \
- '(-P)--pager:_command_names -e:' \
- '--html' \
- '--pipesize:buffer size:' \
- '--client:client text:' \
- '--debug:debug flag:(verbose raw scan parse pipe serial time)' \
- ':word:_dict_words'
+ '(--host -h)'{--host,-h}'[host]:dict server:_hosts' \
+ '(--port -p)'{--port,-p}'[port]:service:' \
+ '(--database -d)'{--database,-d}'[database]:db name:' \
+ '(--match -m)'{--match,-m}'[match]' \
+ '(--strategy -s)'{--strategy,-s}'[strategy]:strategy:' \
+ '(--nocorrect -C)'{--nocorrect,-C}'[nocorrect]' \
+ '(--config -c)'{--config,-c}'[config]:config file:_files' \
+ '(--dbs -D)'{--dbs,-D}'[list dbs]' \
+ '(--strats -S)'{--strats,-S}'[strats]' \
+ '(--serverhelp -H)'{--serverhelp,-H}'[server help]' \
+ '(--info -i)'{--info,-i}'[db info]:db name:' \
+ '(--noauth -a)'{--noauth,-a}'[disable authentication]' \
+ '(--user -u)'{--user,-u}'[user]:user name:' \
+ '(--key -k)'{--key,-k}'[key]:shared secret:' \
+ '(--version -V)'{--version,-V}'[display version]' \
+ '(--license -L)'{--license,-L}'[display license]' \
+ '--help' \
+ '(--verbose -v)'{--verbose,-v}'[be verbose]' \
+ '(--raw -r)'{--raw,-r}'[be very verbose]' \
+ '(--pager -P)'{--pager,-P}'[pager]:program:_command_names -e' \
+ '--html' \
+ '--pipesize:buffer size:' \
+ '--client:client text:' \
+ '--debug:debug flag:(verbose raw scan parse pipe serial time)' \
+ ':word:_dict_words'
Index: Completion/Unix/Command/_grep
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_grep,v
retrieving revision 1.1
diff -u -r1.1 _grep
--- Completion/Unix/Command/_grep 2001/04/02 11:52:20 1.1
+++ Completion/Unix/Command/_grep 2001/08/06 14:21:11
@@ -1,7 +1,7 @@
#compdef grep egrep fgrep
# Ulrik Haugen 2001
-local efgrep="" efarguments arguments
+local arguments matchers
(( $+_is_gnu )) || typeset -gA _is_gnu
@@ -14,59 +14,50 @@
fi
fi
-
-[[ "$service" = [ef]grep ]] && efgrep=t
-
-if [[ -z $efgrep ]]; then
- efarguments=( \
- '(--extended-regexp -F --fixed-strings)-E[extended regexp]' \
- '(-E -F --fixed-strings)--extended-regexp' \
- '(--fixed-strings -E --extended-regexp)-F[fixed strings]' \
- '(-F -E --extended-regexp)--fixed-strings' \
+if [[ $service != [ef]grep ]]; then
+ matchers='(--extended-regexp --fixed-strings --basic-regexp -E -F -G)'
+ arguments=(
+ $matchers{--extended-regexp,-E}'[use extended regular expression]'
+ $matchers{--fixed-strings,-F}'[use literal strings]'
+ $matchers{--basic-regexp,-G}'[use basic regular expression]'
)
fi
-arguments=( \
- '(-e --regexp -f --file)1:pattern:' \
- {'(--regexp -f --file 1)-e+[regexp]','(-e -f --file 1)--regexp='}':regexp:' \
- {'(--file -e --regexp 1)-f+[file]','(-f -e --regexp 1)--file='}':pattern file:_files' \
- \
- '*:files:_files' \
- \
- {'(--after-context)-A+[after context]','(-A)--after-context='}':after context:(1)' \
- '(--text --binary-files)-a[text]' '(-a --binary-files)--text' \
- {'(--before-context)-B+[before context]','(-B)--before-context='}':before context:(1)' \
- {'(--context)-C+[context]','(-C)--context='}':context:(1)' \
- '(--byte-offset)-b[byte offset]' '(-b)--byte-offset' \
- '(-a --text -I)--binary-files:binary files:(binary without-match text)' \
- '(--count)-c[count]' '(-c)--count' \
- {'(--directories -r --recursive)-d+[directories]','(-d -r --recursive)--directories='}':directories:(read skip recurse grep)' \
- \
- $efarguments \
- \
- '(--basic-regexp)-G[basic regexp]' '(-G)--basic-regexp' \
- '(--with-filename)-H[with filename]' '(-H)--with-filename' \
- '(--no-filename)-h[no filename]' '(-h)--no-filename' \
- '--help' \
- '(--binary-files)-I[ignore binary]' \
- '(--ignore-case)-i[ignore case]' '(-i)--ignore-case' \
- '(--files-without-match)-L[files without match]' '(-L)--files-without-match' \
- '(--file-with-matches)-l[files with matches]' '(-l)--files-with-matches' \
- '--mmap' \
- '(--line-number)-n[line number]' '(-n)--line-number' \
- '(--quiet --silent)-q[quiet]' '(-q --quiet)--silent' '(-q --silent)--quiet' \
- '(--recursive -d --directories)-r[recursive]' '(-r -d --directories)--recursive' \
- '(--no-mesages)-s[no messages]' '(-s)--no-messages' \
- '(--version)-V[version]' '(-V)--version' \
- '(--invert-match)-v[invert match]' '(-v)--invert-match' \
- '(--word-regexp)-w[word regexp]' '(-w)--word-regexp' \
- '(--line-regexp)-x[line regexp]' '(-x)--line-regexp' \
- '(--null)-Z[null]' '(-Z)--null' \
+arguments=( $arguments[@]
+ '(--after-context -A)'{--after-context=,-A+}'[specify lines of trailing context]:lines'
+ '(--text -a --binary-files -I)'{--text,-a}'[process binary file as if it were text]'
+ '(--before-context -B)'{--before-context=,-B+}'[specify lines of leading context]:lines'
+ '(--context,-C)'{--context=,-C+}'[specify lines of context]:lines'
+ '(--byte-offset -b -c)'{--byte-offset,-b}'[print the byte offset with output lines]'
+ '(--text -a -I)--binary-files=[specify type to assume for binary files]:file type:(binary without-match text)'
+ '(--count -c --byte-offset -b --line-number -n)'{--count,-c}'[only print a count of matching lines]'
+ '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)'
+ '(1)*'{--regexp=,-e+}'[specify pattern]:pattern'
+ '(1)*'{--file=,-f+}'[specify pattern file]:file:_files'
+ '(--with-filename -H --no-filename -h)'{--with-filename,-H}'[print filename with each match]'
+ '(--no-filename -h --with-filename -H --null -Z --files-without-match -L --file-with-matches -l)'{--no-filename,-h}'[suppress printing of filenames]'
+ '(--text -a --binary-files)-I[process binary files as if non-matching]'
+ '(--ignore-case -i -y)'{--ignore-case,-i,-y}'[case-insensitive]'
+ '(--files-without-match -L --file-with-matches -l --no-filename -h)'{--files-without-match,-L}"[output non-matching files' names only]"
+ '(--files-with-matches -l --files-without-match -L --no-filename -h)'{--files-with-matches,-l}"[output matching files' names only]"
+ '(--line-number -n -c)'{--line-number,-n}'[prefix output with line numbers]'
+ '(--quiet --silent -q)'{--quiet,--silent,-q}'[suppress normal output]'
+ '(--recursive -r -d --directories)'{--recursive,-r}'[recurse subdirectories]'
+ '(--no-mesages -s)'{--no-messages,-s}'[suppress messages about unreadable]'
+ '(--version -V)'{--version,-V}'[display version info]'
+ '(--invert-match -v)'{--invert-match,-v}'[select non-matching lines]'
+ '(--word-regexp -w --line-regexp -x)'{--word-regexp,-w}'[force pattern to match only whole words]'
+ '(--line-regexp -x --word-regexp -w)'{--line-regexp,-x}'[force pattern to match only whole lines]'
+ '(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after FILE name]'
+ '--help[display help]'
+ '--mmap[memory map input]'
+ '(-e --regexp -f --file)1:pattern:_guard "^--*"'
+ '*:files:_files'
)
# remove long options?
[[ -z "$_is_gnu[$words[1]]" ]] &&
- arguments=( ${${${${arguments:#*\)--*}:#--*}//--[^ )]#/}/\( #\)/} )
+ arguments=( ${${${arguments:#(|*\)(\*|))--*}//--[^ )]#/}/\( #\)/} )
-_arguments -s $arguments
+_arguments -s $arguments[@]
Index: Completion/Unix/Command/_loadkeys
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_loadkeys,v
retrieving revision 1.3
diff -u -r1.3 _loadkeys
--- Completion/Unix/Command/_loadkeys 2001/05/03 13:05:49 1.3
+++ Completion/Unix/Command/_loadkeys 2001/08/06 14:21:11
@@ -3,22 +3,16 @@
case $OSTYPE in
linux*)
_arguments \
- '(--clearcompose)-c[clearcompose]' \
- '(-c)--clearcompose' \
- '(--default)-d[default]' \
- '(-d)--default' \
- '(--help)-h[help]' \
- '(-h)--help' \
- '(--mktable)-m[mktable]' \
- '(-m)--mktable' \
- '(--clearstrings)-s[clearstrings]' \
- '(-s)--clearstrings' \
- '(--verbose)-v[verbose]' \
- '(-v)--verbose' \
- ':keymap:_files -W /usr/share/keymaps'
+ '(--clearcompose -c)'{--clearcompose,-c}'[clear kernel compose table]' \
+ '(--default -d)'{--default,-d}'[load default keymap file]' \
+ '(--help -h)'{--help,-h}'[display help information]' \
+ '(--mktable -m)'{--mktable,-m}'[output a "defkeymap.c" to stdout]' \
+ '(--clearstrings)'{--clearstrings,-s}'[clear kernel string table]' \
+ '*'{--verbose,-v}'[print more details]' \
+ ':keymap:_files -W /usr/share/keymaps'
;;
solaris*)
- _files -W /usr/share/lib/keytables
+ _files -W /usr/share/lib/keytables
;;
*) _default;;
Index: Completion/Unix/Command/_ls
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ls,v
retrieving revision 1.2
diff -u -r1.2 _ls
--- Completion/Unix/Command/_ls 2001/05/29 17:54:37 1.2
+++ Completion/Unix/Command/_ls 2001/08/06 14:21:11
@@ -14,79 +14,72 @@
fi
fi
-arguments=( \
- '*:files:_files' \
- \
- '(--all -A --almost-all)-a[all]' '(-a -A --almost-all)--all' \
- '(--almost-all -a --all)-A[almost all]' '(-A -a --all)--almost-all' \
- '(--ignore-backups)-B[ignore backups]' '(-B)--ignore-backups' \
- '(--directory)-d[directory]' '(-d)--directory' \
- {'(--ignore)-I+[ignore]','(-I)--ignore='}':ignore:' \
- '(--dereference)-L[dereference]' '(-L)--dereference' \
- '(--recursive)-R[recursive]' '(-R)--recursive' \
- \
- '(--no-group)-G[no group]' '(-G)--no-group' \
- '(--human-readable -H --si)-h[human readable]' '(-h -H --si)--human-readable' \
- '(--si -h --human-readable)-H[si]' '(-H -h --human-readable)--si' \
- '(--inode)-i[inode]' '(-i)--inode' \
- \
- '(--format -o -1 -C -m -x)-l[long]' \
- '(--format -l --no-group -1 -C -m -x)-o[no group, long]' \
- '(--format -l -o -C -m -x)-1[single column]' \
- '(--format -l -o -1 -m -x)-C[sort vertically]' \
- '(--format -l -o -1 -C -x)-m[comma separated]' \
- '(--format -l -o -1 -C -m)-x[sort horizontally]' \
- '(-l -o -1 -C -m -x)--format=:format:(verbose long commas horizontal across vertical single-column)' \
- \
- '(--size -f)-s[size]' '(-s -f)--size' \
- \
- '(--time -u)-c[status change time]' \
- '(--time -c)-u[access time]' \
- '(-c -u)--time=:time:(ctime status use atime access)' \
- \
- '(-a --all -U -l --format -s --size -t --sort)-f[no sort, all]' \
- '(--reverse)-r[reverse]' '(-r)--reverse' \
- \
- '(--sort -t -U -v -X)-S[sort by size]' \
- '(--sort -S -U -v -X)-t[sort by time]' \
- '(--sort -S -t -v -X)-U[no sort]' \
- '(--sort -S -t -U -X)-v[sort by version]' \
- '(--sort -S -t -U -v)-X[sort by extension]' \
- '(-S -t -U -v -X)--sort=:sort:(size time none version extension)' \
- \
- '--color=-::color:(never always auto)' \
- \
- '(--classify --indicator-style -p --file-type)-F[classify]' \
- '(-F --indicator-style -p --file-type)--classify' \
- '(--file-type --indicator-style -F --classify)-p[file type]' \
- '(-p --indicator-style -F --classify)--file-type' \
- '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify)' \
- \
- '--full-time' \
- \
- '(--kilobytes --block-size)-k[kilobytes]' '(-k --blocksize)--kilobytes' \
- '(-k --kilobytes)--block-size:blocksize:(1024)' \
- \
- '(--numeric-uid-gid)-n[numeric uid, gid]' \
- {'(--tabsize)-T+[tabsize]','(-T)--tabsize='}':tabsize:(8)' \
- {'(--width)-w+[width]','(-w)--width='}':width:(80)' \
- \
- '(--quoting-style --escape -N --literal -Q --quote-name)-b[escape]' \
- '(--quoting-style -b -N --literal -Q --quote-name)--escape' \
- '(--quoting-style -b --escape --literal -Q --quote-name)-N[literal]' \
- '(--quoting-style -b --escape -N -Q --quote-name)--literal' \
- '(--quoting-style -b --escape -N --literal --quote-name)-Q[quote name]' \
- '(--quoting-style -b --escape -N --literal -Q)--quote-name' \
- '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:(literal shell shell-always c escape clocale locale)' \
- \
- '(--hide-control-chars --show-control-chars)-q[hide control chars]' \
- '(-q --show-control-chars)--hide-control-chars' \
- '(-q --hide-control-chars)--show-control-chars' \
- '--version' \
+arguments=(
+ '(--all -a -A --almost-all)'{--all,-a}'[list entries starting with .]'
+ '(--almost-all -A -a --all)'{--almost-all,-A}'[list all except . and ..]'
+ '(--ignore-backups -B)'{--ignore-backups,-B}"[don't list entries ending with ~]"
+ '(--directory -d)'{--directory,-d}'[list directory entries instead of contents]'
+ '(--ignore,-I)'{--ignore,-I}"[don't list entires matching pattern]:pattern:"
+ '(--dereference -L)'{--dereference,-L}'[list referenced file for sym link]'
+ '(--recursive -R)'{--recursive,-R}'[list subdirectories recursively]'
+
+ '(--no-group -G)'{--no-group,-G}'[inhibit display of group information]'
+ '(--human-readable -h -H --si)'{--human-readable,-h}'[print sizes in human readable form]'
+ '(--si -H -h --human-readable)'{--si,-H}'[sizes in human readable form; powers of 1000]'
+ '(--inode -i)'{--inode,-i}'[print file inode numbers]'
+
+ '(--format -o -1 -C -m -x)-l[long listing]'
+ '(--format -l --no-group -G -1 -C -m -x)-o[no group, long]'
+ '(--format -l -o -C -m -x)-1[single column output]'
+ '(--format -l -o -1 -m -x)-C[sort vertically]'
+ '(--format -l -o -1 -C -x)-m[comma separated]'
+ '(--format -l -o -1 -C -m)-x[sort horizontally]'
+ '(-l -o -1 -C -m -x)--format=:format:(verbose long commas horizontal across vertical single-column)'
+
+ '(--size -s -f)'{--size,-s}'[display size of each file in blocks]'
+
+ '(--time -u)-c[status change time]'
+ '(--time -c)-u[access time]'
+ '(-c -u)--time=[specify time to show]:time:(ctime status use atime access)'
+
+ '(-a --all -U -l --format -s --size -t --sort --full-time)-f[unsorted, all, short list]'
+ '(--reverse)'{--reverse,-r}'[reverse sort order]'
+
+ '(--sort -t -U -v -X)-S[sort by size]'
+ '(--sort -S -U -v -X)-t[sort by modification time]'
+ '(--sort -S -t -v -X)-U[unsorted]'
+ '(--sort -S -t -U -X)-v[sort by version (filename treated numerically)]'
+ '(--sort -S -t -U -v)-X[sort by extension]'
+ '(-S -t -U -v -X)--sort=:sort:(size time none version extension)'
+
+ '--color=-[control use of color]:color:(never always auto)'
+
+ '(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append file type indicators]'
+ '(--file-type -p --indicator-style -F --classify)'{--file-type,-p}'[append file type indicators except *]'
+ '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify)'
+
+ '(-f)--full-time[list both full date and full time]'
+
+ '(--kilobytes -k --block-size)'{--kilobytes,-k}'[use block size of 1k]'
+ '(-k --kilobytes)--block-size=[specify block size]:block size (bytes):(1024)'
+
+ '(--numeric-uid-gid -n)'{--numeric-uid-gid,-n}'[numeric uid, gid]'
+ '(--tabsize -T)'{--tabsize=,-T+}'[specify tab size]:tab size'
+ '(--width -w)'{--width=,-w+}'[specify screen width]:screen width'
+
+ '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--escape,-b}'[print octal escapes for control characters]'
+ '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-N}'[print raw characters]'
+ '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--quote-name,-Q}'[quote names]'
+ '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:(literal shell shell-always c escape clocale locale)'
+
+ '(--hide-control-chars -q --show-control-chars)'{--hide-control-chars,-q}'[hide control chars]'
+ '(-q --hide-control-chars)--show-control-chars'
+ '--version[display version information]'
+ '*:files:_files'
)
# remove long options?
[[ -z "$_is_gnu[$words[1]]" ]] &&
- arguments=( ${${${${arguments:#*\)--*}:#--*}//--[^ )]#/}/\( #\)/} )
+ arguments=( ${${${arguments:#(|*\))--*}//--[^ )]#/}/\( #\)/} )
_arguments -s $arguments
Index: Completion/Unix/Command/_patch
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_patch,v
retrieving revision 1.1
diff -u -r1.1 _patch
--- Completion/Unix/Command/_patch 2001/04/02 11:59:23 1.1
+++ Completion/Unix/Command/_patch 2001/08/06 14:21:11
@@ -56,7 +56,7 @@
'* --quoting-style=WORD[, ]*' '--quoting-style=[quoting style]:quoting style:(literal shell shell-always c escape)'
- '*(\[-[a-zA-Z]#b[a-zA-Z]#\]| -b[, ])*' '(--backup)-b[back up original]'
+ '*(\[-[a-zA-Z]#b[a-zA-Z]#\]| -b[, ])*' '(--backup)-b[backup original]'
'* --backup[, ]*' '(-b)--backup[backup original]'
'* --backup-if-mismatch[, ]*' '(--no-backup-if-mismatch)--backup-if-mismatch[back up if not match exactly]'
'* --no-backup-if-mismatch[, ]*' '(--backup-if-mismatch)--no-backup-if-mismatch[back up only if otherwise requested]'
Index: Completion/Unix/Command/_user_admin
===================================================================
RCS file: _user_admin
diff -N _user_admin
--- /dev/null Thu May 24 22:33:05 2001
+++ _user_admin Mon Aug 6 07:21:12 2001
@@ -0,0 +1,67 @@
+#compdef useradd usermod groupadd groupmod
+
+local args shells home=${${words[(r)-D]:+b}:-d} sun=" -s"
+
+if [[ $service = user* ]]; then
+ if [[ -r /etc/shells ]]; then
+ shells=( $(</etc/shells) )
+ else
+ shells=( ${(M)commands:#*/(|[abckz]|tc|ba)sh} )
+ fi
+
+ args=(
+ '(-D)-c+[comment]:comment'
+ "(-D)-${home}+[home directory]:home directory:_directories -W /"
+ '(-D)-e+[specify expriration date]:expiration date (YYYY-MM-DD)'
+ '(-D)-f+[specify inactive days]:inactive days'
+ '(-D)-g+[initial group]:initial group:_groups'
+ '(-D)-G+[supplementary groups]:supplementary groups:_groups -S,'
+ "(-D)-s+[shell]:shell:( $shells /dev/null )"
+ '(-D)-m[create home directory]'
+ '(-D)-u[uid]:uid'
+ '(-D)-o[allow non unique uid]'
+ )
+ [[ $OSTYPE = linux* ]] && args=( $args[@]
+ '(-D)-p+[specify encrypted password]:encrypted password' )
+
+ if [[ $service = useradd ]]; then
+ if [[ $OSTYPE = linux* ]]; then
+ args=( $args[@]
+ "(-D -k)-M[don't create home]"
+ '(-D)-r[create system account]'
+ "(-D)-n[don't create mirrored user]"
+ )
+ unset sun
+ fi
+ args=( $args[@]
+ "(-c -G -m -k -M -p -u -o -n -r$sun)-D[modify or display defaults]"
+ '(-D -M)-k[skeleton home directory]:skeleton directory:_directories -W /'
+ ':username'
+ )
+ else
+ [[ $OSTYPE = linux* ]] && args=( $args[@]
+ "(-U)-L[lock user's password]"
+ "(-L)-U[unlock user's password]"
+ )
+ args=( $args[@]
+ '-l[specify new user name]:new username'
+ ':username:_users'
+ )
+ fi
+else
+ args=( '-g+[gid]:gid' '-o[allow non unique gid]' )
+ if [[ $service = groupadd ]]; then
+ args=( $args[@] ':group name' )
+ [[ $OSTYPE = linux* ]] && args=( $args[@]
+ '-r[create system group]'
+ '-f[force]'
+ )
+ else
+ args=( $args[@]
+ '-n[specify new group name]:new group name'
+ ':group name:_groups'
+ )
+ fi
+fi
+
+_arguments -A "-*" -s $args[@]
Index: Completion/Unix/Command/_wget
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_wget,v
retrieving revision 1.2
diff -u -r1.2 _wget
--- Completion/Unix/Command/_wget 2001/05/29 17:54:37 1.2
+++ Completion/Unix/Command/_wget 2001/08/06 14:21:12
@@ -3,72 +3,67 @@
local curcontext="$curcontext" state line
typeset -A opt_args
-local tmp1 tmp2
-
_arguments -C -s \
- '(--version)-V[version]' '(-V)--version' \
- '(--help)-h[help]' '(-h)--help' \
- '(--background)-b[background]' '(-b)--background' \
- {'(--execute)-e+[execute]','(-e)--execute='}':.wgetrc command:' \
- {'(--output-file)-o+[output file]','(-o)--output-file='}':log file to output:_files' \
- {'(--append-output)-a+[append output file]','(-a)--append-output='}':log file to append:_files' \
- '(--debug)-d[debug]' '(-d)--debug' \
- '(--quiet)-q[quiet]' '(-q)--quiet' \
- '(--verbose)-v[verbose]' '(-v)--verbose' \
- '*-n+[no]:flags:->noflags' \
- {'(--input-file)-i+[input file]','(-i)--input-file='}':file containing URLs:_files' \
- '(--force-html)-F[force html]' '(-F)--force-html' \
- {'(--base)-B+[prepend URL to relative links]','(-B)--base='}':base URL:_urls' \
+ '(--version -V)'{--version,-V}'[display version info]' \
+ '(--help -h)'{--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]' \
+ '*-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]' \
+ '(--base -B)'{--base=,-B+}'[prepend URL to relative links]:base URL:_urls' \
'--bind-address=:address to bind to (hostname or IP):_hosts' \
- {'(--tries)-t+[tries]','(-t)--tries='}':number of retries:(0)' \
- {'(--output-document)-O+[output document]','(-O)--output-document='}':output file:_files' \
- '(--continue)-c[continue]' '(-c)--continue' \
- '--dot-style=:display style:(default binary mega giga micro)' \
- '(--timestamping)-N[timestamping]' '(-N)--timestamping' \
- '(--server-response)-S[server response]' '(-S)--server-response' \
- '--spider' \
- {'(--timeout)-T+[timeout]','(-T)--timeout='}':read timeout(seconds):' \
- {'(--wait)-w+[wait]','(-w)--wait='}':wait between retrievals(seconds):' \
- '--waitretry=:seconds to wait between retries of a retrieval:' \
- {'(--proxy --use-proxy)-Y+[proxy]','(-Y --use-proxy)--proxy=','(-Y --proxy)--use-proxy='}':proxy:(on off)' \
- {'(--quota)-Q+[quota]','(-Q)--quota='}':number:' \
- '(--force-directories)-x[force directories]' '(-x)--force-directories' \
- {'(--directory-prefix)-P+[directory prefix]','(-P)--directory-prefix='}':prefix:_files -/' \
+ '(--tries -t)'{--tries=,-t+}'[set number of retries]:number of retries' \
+ '(--output-document -O)'{--output-document=,-O+}'[specify file to write documents to]:output file:_files' \
+ '(--continue -c)'{--continue,-c}'[continue getting an existing file]' \
+ '--dot-style=[set retrieval display style]:display style:(default binary mega giga micro)' \
+ '(--timestamping -N)'{--timestamping,-N}'[retrieve only files newer than existing]' \
+ '(--server-response -S)'{--server-response,-S}'[print server response]' \
+ "--spider[don't download anything]" \
+ '(--timeout -T)'{--timeout=,-T+}'[specify read timeout]:read timeout (seconds)' \
+ '(--wait,-w)'{--wait=,-w+}'[specify wait between retrievals]:wait between retrievals (seconds)' \
+ '--waitretry=:wait between retries of a retrieval (seconds)' \
+ '(--proxy -Y)'{--proxy=,-Y+}'[turn proxy on or off]:proxy use:(on off)' \
+ '(--quota -Q)'{--quota=,-Q+}'[set retrieval quota]:number' \
+ '(--force-directories -x)'{--force-directories,-x}'[force creation of 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[save all text/html files with a .html extension]' \
- '(-E)--html-extension' \
- '--ignore-length' \
+ '(--html-extension -E)'{--html-extension,-E}'[save all text/html files with a .html extension]' \
+ "--ignore-length[ignore \`Content-Length' header field]" \
'--header=:string:' \
'--proxy-user=:user:' \
'--proxy-passwd=:password:' \
'--referer=:url:_urls' \
- '(--save-headers)-s[save headers]' '(-s)--save-headers' \
- {'(--user-agent)-U+[user agent]','(-U)--user-agent='}':user-agent:' \
+ '(--save-headers -s)'{--save-headers,-s}'[save http headers]' \
+ '(--user-agent -U)'{--user-agent=,-U+}'[specify user agent to identify as]:user-agent' \
'--retr-symlinks' \
- {'(--glob)-g+[glob]','(-g)--glob='}':glob:(on off)' \
+ '(--glob -g)'{--glob=,-g+}'[turn file globbing on or off]:glob:(on off)' \
'--passive-ftp' \
- '(--recursive)-r[recursive]' '(-r)--recursive' \
- {'(--level)-l+[level]','(-l)--level='}':level:(0)' \
+ '(--recursive -r)'{--recursive,-r}'[recurse subdirectories]' \
+ '(--level -l)'{--level=,-l+}'[specify maximum recursion depth]:level' \
'--delete-after' \
- '(--convert-links)-k[convert links]' '(-k)--convert-links' \
- '(--backup-converted)-K[backup files before conversion]' \
- '(-K)--backup-converted' \
- '(--mirror)-m[mirror]' '(-m)--mirror' \
- '(--page-requisites)-p[get all images needed to display page]' \
- '(-p)--page-requisites' \
- {'(--accept)-A+[accept]','(-A)--accept='}':accepted extensions:' \
- {'(--reject)-R+[reject]','(-R)--reject='}':rejected extensions:' \
- {'(--domains)-D+[domains]','(-D)--domains='}':accepted domains:' \
+ '(--convert-links -k)'{--convert-links,-k}'[convert links to be relative]' \
+ '(--backup-converted -K)'{--backup-converted,-K}'[backup files before conversion]' \
+ '(--mirror -m -r -N -l)'{--mirror,-m}'[mirror (-r -N -l inf -nr)]' \
+ '(--page-requisites -p)'{--page-requisites,-p}'[get all images needed to display page]' \
+ '(--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:' \
'--follow-ftp' \
'--follow-tags=:HTML tags:' \
- {'(--ignore-tags)-G+[ignored HTML tags]','(-G)--ignore-tags='}':HTML tags:' \
- '(--span-hosts)-H[span hosts]' '(-H)--span-hosts' \
- '(--relative)-L[follow relative links only]' '(-L)--relative' \
- {'(--include-directories)-I+[include directories]','(-I)--include-directories='}':allowed directories:' \
- {'(--exclude-directories)-X+[exclude directories]','(-X)--exclude-directories='}':excluded directories:' \
+ '(--ignore-tags -G)'{--ignore-tags=,-G+}'[spcify 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' \
@@ -76,16 +71,10 @@
'--no-directories' \
'--no-host-directories' \
'--dont-remove-listing' \
- '--cache=:cache:(on off)' \
+ '(--cache -C)'{--cache=,-C+}'[(dis)allow server-cached data]:cache:(on off)' \
'--htmlify=:htmlify:' \
'--no:no:->noflags' \
'*:url:_urls' && return 0
-
-# '--backups:backups:' \
-# '-W' \
-# '(--email-address)-E+[email address]' '(-E)--email-address' \
-# '-C+[cache]:cache:(on off)' \
-# '--force-hier' \
case "$state" in
noflags)
Index: Completion/Unix/Type/_diff_options
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_diff_options,v
retrieving revision 1.2
diff -u -r1.2 _diff_options
--- Completion/Unix/Type/_diff_options 2001/05/21 14:44:49 1.2
+++ Completion/Unix/Type/_diff_options 2001/08/06 14:21:12
@@ -49,19 +49,16 @@
--unchanged-group-format"
_arguments -s \
- '(-i)--ignore-case[case insensitive]' \
- '(--ignore-case)-i[case insensitive]' \
- '(-w)--ignore-all-space[ignore all white space]' \
- '(--ignore-all-space)-w[ignore all white space]' \
+ '(--ignore-case -i)'{--ignore-case,-i}'[case insensitive]' \
+ '(--ignore-all-space -w)'{--ignore-all-space,-w}'[ignore all white space]' \
'(-b)--ignore-space-change[ignore changes in the amount of white space]' \
'(--ignore-space-change)-b[ignore changes in the amount of white space]' \
'(-B)--ignore-blank-lines[ignore lines that are all blank]' \
'(--ignore-blank-lines)-B[ignore lines that are all blank]' \
'(-I)--ignore-matching-lines=[ignore lines that match regex]:line exclusion regex:' \
'(--ignore-matching-lines)-I+[ignore lines that match regex]:line exclusion regex:' \
- '(-a)--text[treat all files as text]' \
- '(--text)-a[treat all files as text]' \
- "($of $oss)--context=-[context diff]:number of lines of copied context:" \
+ '(--text -a)'{--text,-a}'[treat all files as text]' \
+ "($of $oss)--context=-[output a context diff]:number of lines of copied context:" \
"($of $oss)-C+[output a context diff]:number of lines of copied context:" \
"($of $oss)-c[output a context diff]" \
"($of $oss)--unified=-[output a unified diff]:number of lines of unified context:" \
@@ -95,16 +92,12 @@
"($ofwl $ouc $oss)--old-line-format=[set old line format]:old line format:" \
"($ofwl $ouc $oss)--new-line-format=[set new line format]:new line format:" \
"($ofwl $ouc $oss)--unchanged-line-format=[set unchanged line format]:unchanged line format:" \
- '(-l)--paginate[output through pr]' \
- '(--paginate)-l[output through pr]' \
- '(-t)--expand-tabs[expand tabs to spaces]' \
- '(--expand-tabs)-t[expand tabs to spaces]' \
- '(-T)--initial-tab[prepend a tab]' \
- '(--initial-tab)-T[prepend a tab]' \
+ '(--paginate -l)'{--paginate,-l}'[output through pr]' \
+ '(--expand-tabs -t)'{--expand-tabs,-t}'[expand tabs to spaces]' \
+ '(--initial-tab -T)'{--initial-tab,-T}'[prepend a tab]' \
'(-r)--recursive[recursively compare subdirectories]' \
'(--recursive)-r[recursively compare subdirectories]' \
- '(-N)--new-file[treat absent files as empty]' \
- '(--new-file)-N[treat absent files as empty]' \
+ '(--new-file -N)'{--new-file,-N}'[treat absent files as empty]' \
'(-P)--unidirectional-new-file[treat absent first files as empty]' \
'(--unidirectional-new-file)-P[treat absent first files as empty]' \
'(-s)--report-identical-files[report when two files are the same]' \
@@ -116,12 +109,10 @@
'(-S)--starting-file=[set first file in comparison]:start with file:_files' \
'(--starting-file)-S+[set first file in comparison]:start with file:_files' \
'--horizon-lines=[set number of lines to keep in prefix and suffix]:number of horizon lines:' \
- '(-d)--minimal[try to find a smaller set of changes]' \
- '(--minimal)-d[try to find a smaller set of changes]' \
+ '(--minimal -d)'{--minimal,-d}'[try to find a smaller set of changes]' \
'(-H)--speed-large-files[assume large files and many small changes]' \
'(--speed-large-files)-H[assume large files and many small changes]' \
- '(--version)-v[output version info]' \
- '(-v)--version[output version info]' \
+ '(--version -v)'{--version,-v}'[output version info]' \
'--help[help text]' \
"$@"
else
Index: Completion/Unix/Type/_groups
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_groups,v
retrieving revision 1.1
diff -u -r1.1 _groups
--- Completion/Unix/Type/_groups 2001/04/02 11:37:41 1.1
+++ Completion/Unix/Type/_groups 2001/08/06 14:21:12
@@ -1,4 +1,4 @@
-#compdef newgrp
+#compdef newgrp groupdel
local expl groups tmp
Index: Completion/Unix/Type/_users
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_users,v
retrieving revision 1.2
diff -u -r1.2 _users
--- Completion/Unix/Type/_users 2001/06/25 18:52:15 1.2
+++ Completion/Unix/Type/_users 2001/08/06 14:21:12
@@ -1,4 +1,4 @@
-#compdef passwd groups
+#compdef passwd groups userdel
local expl users
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-06 14:28 PATCH: new and updated completions Oliver Kiddle
@ 2001-08-06 14:30 ` Chmouel Boudjnah
2001-08-06 17:43 ` Borsenkow Andrej
2001-08-08 11:37 ` Oliver Kiddle
2001-08-07 10:36 ` Sven Wischnowsky
1 sibling, 2 replies; 14+ messages in thread
From: Chmouel Boudjnah @ 2001-08-06 14:30 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Oliver Kiddle <opk@u.genie.co.uk> writes:
> anyone can think of a good way to detect RedHat/Mandrake, please let me
/etc/{mandrake,redhat}-release
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-06 14:30 ` Chmouel Boudjnah
@ 2001-08-06 17:43 ` Borsenkow Andrej
2001-08-06 17:47 ` Chmouel Boudjnah
2001-08-08 11:37 ` Oliver Kiddle
1 sibling, 1 reply; 14+ messages in thread
From: Borsenkow Andrej @ 2001-08-06 17:43 UTC (permalink / raw)
To: Chmouel Boudjnah; +Cc: Oliver Kiddle, zsh-workers
Chmouel Boudjnah wrote:
> Oliver Kiddle <opk@u.genie.co.uk> writes:
>
>
>>anyone can think of a good way to detect RedHat/Mandrake, please let me
>>
>
> /etc/{mandrake,redhat}-release
>
>
Meaning
if [[ -e /etc/mandrake-release ]]; then
we are on Mandrake
else ...
{pts/1}% ll /etc/*-release
-rw-r--r-- 1 root root 45 ??? 19 22:30
/etc/mandrake-release
lrwxrwxrwx 1 root root 16 ??? 23 00:32
/etc/redhat-release -> mandrake-release
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-06 17:43 ` Borsenkow Andrej
@ 2001-08-06 17:47 ` Chmouel Boudjnah
0 siblings, 0 replies; 14+ messages in thread
From: Chmouel Boudjnah @ 2001-08-06 17:47 UTC (permalink / raw)
To: Borsenkow Andrej; +Cc: Oliver Kiddle, zsh-workers
Borsenkow Andrej <Andrej.Borsenkow@mow.siemens.ru> writes:
> Chmouel Boudjnah wrote:
>
> > Oliver Kiddle <opk@u.genie.co.uk> writes:
> >
> >>anyone can think of a good way to detect RedHat/Mandrake, please let me
> >>
> > /etc/{mandrake,redhat}-release
> >
>
> Meaning
yep better to do a :
if [[ -e /etc/mandrake-release ]]; then
we are on Mandrake
elif [[ -e /etc/redhat-release ]]; then
we are on RedHat
fi
mandrake one before redhat.
> if [[ -e /etc/mandrake-release ]]; then
> we are on Mandrake
> else ...
>
> {pts/1}% ll /etc/*-release
> -rw-r--r-- 1 root root 45 ??? 19 22:30
> /etc/mandrake-release
> lrwxrwxrwx 1 root root 16 ??? 23 00:32
> /etc/redhat-release -> mandrake-release
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-06 14:28 PATCH: new and updated completions Oliver Kiddle
2001-08-06 14:30 ` Chmouel Boudjnah
@ 2001-08-07 10:36 ` Sven Wischnowsky
2001-08-07 11:04 ` Oliver Kiddle
1 sibling, 1 reply; 14+ messages in thread
From: Sven Wischnowsky @ 2001-08-07 10:36 UTC (permalink / raw)
To: zsh-workers
Oliver Kiddle wrote:
> ...
>
> I've rewritten _dd to use _values. It highlights a bug/limitation of
> _values: it continues to offer options which have already been
> specified as if they were preceded by `*' in the spec. It wouldn't do
> this if, for example, the values were comma separated.
Yes, _values only ever works on a single word. The easiest fix for now
is to remove the specs already used in _dd itself. Dunno if this should
be put into a separate function or _values itself.
> I've also made a start of updating functions to make better use of the
> grouping of options with the same description. I've changed dict, GNU
> diff, GNU grep, loadkeys, GNU ls, GNU patch and wget. Things don't seem
> to work perfectly if I type grep --<tab> - the list is messed up but is
> fine after grep -<tab>.
Oops. Indeed -- because it matched the hyphens in the descriptions.
It also had problems with correction.
Bye
Sven
Index: Completion/Base/Completer/_approximate
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_approximate,v
retrieving revision 1.3
diff -u -r1.3 _approximate
--- Completion/Base/Completer/_approximate 2001/05/29 17:54:08 1.3
+++ Completion/Base/Completer/_approximate 2001/08/07 10:36:29
@@ -10,7 +10,7 @@
[[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
-local _comp_correct _correct_expl comax cfgacc match
+local _comp_correct _correct_expl _correct_group comax cfgacc match
local oldcontext="${curcontext}" opm="$compstate[pattern_match]"
if [[ "$1" = -a* ]]; then
@@ -58,6 +58,9 @@
# else
PREFIX="(#a${_comp_correct})$PREFIX"
# fi
+
+ (( $_correct_group )) && _correct_expl[_correct_group]=${argv[(R)-*[JV]]}
+
builtin compadd "$_correct_expl[@]" "$@"
}
trap 'unfunction compadd' EXIT INT
@@ -72,6 +75,8 @@
_description corrections _correct_expl corrections \
"e:$_comp_correct" "o:$PREFIX$SUFFIX"
+
+ _correct_group="$_correct_expl[(I)-*[JV]]"
if _complete; then
if zstyle -t ":completion:${curcontext}:" insert-unambiguous &&
Index: Completion/Base/Utility/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_describe,v
retrieving revision 1.8
diff -u -r1.8 _describe
--- Completion/Base/Utility/_describe 2001/07/27 12:56:57 1.8
+++ Completion/Base/Utility/_describe 2001/08/07 10:36:29
@@ -78,9 +78,13 @@
fi
if [[ -n $_mats ]]; then
- compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -O $_strs -D $_mats -s $_strs
+ compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs - \
+ "${(@M)${(@P)_strs}##([^:\\]|\\?)##}"
+ compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_mats - \
+ "${(@M)${(@P)_strs}##([^:\\]|\\?)##}"
else
- compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -O $_strs -a $_strs
+ compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs - \
+ "${(@M)${(@P)_strs}##([^:\\]|\\?)##}"
fi
done
set - "$_argv[@]"
Index: Completion/Unix/Command/_dd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_dd,v
retrieving revision 1.2
diff -u -r1.2 _dd
--- Completion/Unix/Command/_dd 2001/08/06 14:42:04 1.2
+++ Completion/Unix/Command/_dd 2001/08/07 10:36:29
@@ -1,14 +1,22 @@
#compdef dd
-_values -S '=' 'option' \
- 'if[specify input file]:input file:_tilde_files' \
- 'of[specify output file]:output file:_tilde_files' \
- 'ibs[input block size]:block size (bytes)' \
- 'obs[output block size]:block size (bytes)' \
- 'bs[block size]:block size (bytes)' \
- 'cbs[conversion buffer size]:buffer size (bytes)' \
- 'skip[input blocks initially skipped]:blocks' \
- 'seek[output blocks initially skipped]:blocks' \
- 'files[specify number of input files to copy and concatenate]:number of files' \
- 'count[number of input blocks to copy]:blocks' \
+local opts
+
+opts=(
+ 'if[specify input file]:input file:_tilde_files'
+ 'of[specify output file]:output file:_tilde_files'
+ 'ibs[input block size]:block size (bytes)'
+ 'obs[output block size]:block size (bytes)'
+ 'bs[block size]:block size (bytes)'
+ 'cbs[conversion buffer size]:buffer size (bytes)'
+ 'skip[input blocks initially skipped]:blocks'
+ 'seek[output blocks initially skipped]:blocks'
+ 'files[specify number of input files to copy and concatenate]:number of files'
+ 'count[number of input blocks to copy]:blocks'
'conv[specify conversions to apply]:conversion:_values -s , "conversion" ascii ebcdic ibm block unblock lcase ucase swab noerror sync'
+)
+
+[[ "$PREFIX$SUFFIX" != *\=* ]] &&
+ opts=( "${(@)opts:#(${(j:|:)~words[2,-1]%%\=*})\[*}" )
+
+_values -S '=' 'option' "$opts[@]"
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-07 10:36 ` Sven Wischnowsky
@ 2001-08-07 11:04 ` Oliver Kiddle
2001-08-08 7:19 ` Sven Wischnowsky
0 siblings, 1 reply; 14+ messages in thread
From: Oliver Kiddle @ 2001-08-07 11:04 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky wrote:
>
> Yes, _values only ever works on a single word. The easiest fix for now
> is to remove the specs already used in _dd itself. Dunno if this should
> be put into a separate function or _values itself.
I'd have thought it should be in _values itself as _values should
ideally be able to work with multiple words. This "easiest fix" isn't
going to handle explicit exclusion lists though. I'm not sure whether
there shouldn't be exclusions between bs and ibs/obs for dd but as the
exclusions don't work here, I didn't worry.
Oliver
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-07 11:04 ` Oliver Kiddle
@ 2001-08-08 7:19 ` Sven Wischnowsky
2001-08-08 17:23 ` Oliver Kiddle
0 siblings, 1 reply; 14+ messages in thread
From: Sven Wischnowsky @ 2001-08-08 7:19 UTC (permalink / raw)
To: zsh-workers
Oliver Kiddle wrote:
> ...
>
> I'd have thought it should be in _values itself as _values should
> ideally be able to work with multiple words.
Yes, here is the patch. It adds the -w option to _values which means
that it will look at all words on the line.
> This "easiest fix" isn't
> going to handle explicit exclusion lists though. I'm not sure whether
> there shouldn't be exclusions between bs and ibs/obs for dd but as the
> exclusions don't work here, I didn't worry.
You can now start to worry ;-)
Bye
Sven
Index: Completion/Unix/Command/_dd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_dd,v
retrieving revision 1.3
diff -u -r1.3 _dd
--- Completion/Unix/Command/_dd 2001/08/07 10:38:36 1.3
+++ Completion/Unix/Command/_dd 2001/08/08 07:19:00
@@ -2,21 +2,15 @@
local opts
-opts=(
- 'if[specify input file]:input file:_tilde_files'
- 'of[specify output file]:output file:_tilde_files'
- 'ibs[input block size]:block size (bytes)'
- 'obs[output block size]:block size (bytes)'
- 'bs[block size]:block size (bytes)'
- 'cbs[conversion buffer size]:buffer size (bytes)'
- 'skip[input blocks initially skipped]:blocks'
- 'seek[output blocks initially skipped]:blocks'
- 'files[specify number of input files to copy and concatenate]:number of files'
- 'count[number of input blocks to copy]:blocks'
+_values -w 'option' \
+ 'if[specify input file]:input file:_tilde_files' \
+ 'of[specify output file]:output file:_tilde_files' \
+ 'ibs[input block size]:block size (bytes)' \
+ 'obs[output block size]:block size (bytes)' \
+ 'bs[block size]:block size (bytes)' \
+ 'cbs[conversion buffer size]:buffer size (bytes)' \
+ 'skip[input blocks initially skipped]:blocks' \
+ 'seek[output blocks initially skipped]:blocks' \
+ 'files[specify number of input files to copy and concatenate]:number of files' \
+ 'count[number of input blocks to copy]:blocks' \
'conv[specify conversions to apply]:conversion:_values -s , "conversion" ascii ebcdic ibm block unblock lcase ucase swab noerror sync'
-)
-
-[[ "$PREFIX$SUFFIX" != *\=* ]] &&
- opts=( "${(@)opts:#(${(j:|:)~words[2,-1]%%\=*})\[*}" )
-
-_values -S '=' 'option' "$opts[@]"
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.132
diff -u -r1.132 compsys.yo
--- Doc/Zsh/compsys.yo 2001/08/06 15:56:23 1.132
+++ Doc/Zsh/compsys.yo 2001/08/08 07:19:03
@@ -3975,6 +3975,10 @@
Thus the values completed appear in the same word on the command line,
unlike completion using tt(_arguments).
+Normally, tt(_values) will only use the current word to determine
+which values are already present on the command line. If the tt(-w)
+option is given, the other arguments are used, too.
+
The first argument (after the options and separator character if they
are given) is used as a string to print as a description before
listing the values.
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.71
diff -u -r1.71 computil.c
--- Src/Zle/computil.c 2001/07/30 08:42:56 1.71
+++ Src/Zle/computil.c 2001/08/08 07:19:04
@@ -2499,6 +2499,7 @@
char **defs; /* original strings */
int ndefs; /* number of ... */
int lastt; /* last time used */
+ int words; /* if to look at other words */
};
/* One value definition. */
@@ -2556,18 +2557,23 @@
Cvval val, *valp;
Caarg arg;
char **oargs = args, sep = '\0', asep = '=', *name, *descr, *p, *q, **xor, c;
- int xnum, multi, vtype, hassep = 0;
+ int xnum, multi, vtype, hassep = 0, words = 0;
- while (args[0][0] == '-' && (args[0][1] == 's' || args[0][1] == 'S') &&
+ while (args[0][0] == '-' &&
+ (args[0][1] == 's' || args[0][1] == 'S' || args[0][1] == 'w') &&
!args[0][2]) {
if (args[0][1] == 's') {
hassep = 1;
sep = args[1][0];
- } else
+ args += 2;
+ } else if (args[0][1] == 'S') {
asep = args[1][0];
-
- args += 2;
+ args += 2;
+ } else {
+ words = 1;
+ args++;
+ }
}
if (!args[0] || !args[1]) {
zwarnnam(nam, "not enough arguments", NULL, 0);
@@ -2585,6 +2591,7 @@
ret->defs = zarrdup(oargs);
ret->ndefs = arrlen(oargs);
ret->lastt = time(0);
+ ret->words = words;
for (valp = &(ret->vals); *args; args++) {
int bs = 0;
@@ -2892,6 +2899,35 @@
cv_alloced = 1;
+ if (d->words && compwords[0]) {
+ int i;
+
+ for (i = 1; compwords[i]; i++)
+ if (i != compcurrent - 1)
+ for (str = compwords[i]; str && *str; ) {
+ if ((val = cv_next(d, &str, &arg))) {
+ zaddlinknode(state.vals, ztrdup(val->name));
+ if (arg) {
+ char sav = '\0';
+
+ if (str) {
+ sav = str[-1];
+ str[-1] = '\0';
+ }
+ zaddlinknode(state.vals, ztrdup(arg));
+ if (str)
+ str[-1] = sav;
+ } else
+ zaddlinknode(state.vals, ztrdup(""));
+
+ if (i + 1 < compcurrent)
+ cv_inactive(d, val->xor);
+ }
+ }
+
+ val = NULL;
+ arg = NULL;
+ }
for (str = compprefix; str && *str; ) {
if ((val = cv_next(d, &str, &arg))) {
zaddlinknode(state.vals, ztrdup(val->name));
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-06 14:30 ` Chmouel Boudjnah
2001-08-06 17:43 ` Borsenkow Andrej
@ 2001-08-08 11:37 ` Oliver Kiddle
2001-08-08 12:06 ` Chmouel Boudjnah
2001-08-08 15:52 ` Bart Schaefer
1 sibling, 2 replies; 14+ messages in thread
From: Oliver Kiddle @ 2001-08-08 11:37 UTC (permalink / raw)
To: zsh-workers
Chmouel Boudjnah wrote:
>
> > anyone can think of a good way to detect RedHat/Mandrake, please let me
>
> /etc/{mandrake,redhat}-release
Perfect. Thanks.
Oliver
Index: Completion/Unix/Command/_user_admin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_user_admin,v
retrieving revision 1.1
diff -u -r1.1 _user_admin
--- Completion/Unix/Command/_user_admin 2001/08/06 14:42:04 1.1
+++ Completion/Unix/Command/_user_admin 2001/08/08 11:32:58
@@ -1,6 +1,6 @@
#compdef useradd usermod groupadd groupmod
-local args shells home=${${words[(r)-D]:+b}:-d} sun=" -s"
+local args shells home=${${words[(r)-D]:+b}:-d} sun
if [[ $service = user* ]]; then
if [[ -r /etc/shells ]]; then
@@ -17,31 +17,29 @@
'(-D)-g+[initial group]:initial group:_groups'
'(-D)-G+[supplementary groups]:supplementary groups:_groups -S,'
"(-D)-s+[shell]:shell:( $shells /dev/null )"
- '(-D)-m[create home directory]'
+ '(-D -M)-m[create home directory]'
'(-D)-u[uid]:uid'
'(-D)-o[allow non unique uid]'
)
[[ $OSTYPE = linux* ]] && args=( $args[@]
- '(-D)-p+[specify encrypted password]:encrypted password' )
+ '(-D -U -L)-p+[specify encrypted password]:encrypted password' )
if [[ $service = useradd ]]; then
- if [[ $OSTYPE = linux* ]]; then
- args=( $args[@]
- "(-D -k)-M[don't create home]"
- '(-D)-r[create system account]'
- "(-D)-n[don't create mirrored user]"
- )
- unset sun
- fi
+ [[ -e /etc/redhat-release ]] && args=( $args[@]
+ "(-D -k -m)-M[don't create home]"
+ '(-D)-r[create system account]'
+ "(-D)-n[don't create mirrored user]"
+ )
+ [[ $OSTYPE = linux* ]] || sun=" -s"
args=( $args[@]
"(-c -G -m -k -M -p -u -o -n -r$sun)-D[modify or display
defaults]"
'(-D -M)-k[skeleton home directory]:skeleton
directory:_directories -W /'
':username'
)
else
- [[ $OSTYPE = linux* ]] && args=( $args[@]
- "(-U)-L[lock user's password]"
- "(-L)-U[unlock user's password]"
+ [[ -e /etc/redhat-release ]] && args=( $args[@]
+ "(-U -p)-L[lock user's password]"
+ "(-L -p)-U[unlock user's password]"
)
args=( $args[@]
'-l[specify new user name]:new username'
@@ -52,7 +50,7 @@
args=( '-g+[gid]:gid' '-o[allow non unique gid]' )
if [[ $service = groupadd ]]; then
args=( $args[@] ':group name' )
- [[ $OSTYPE = linux* ]] && args=( $args[@]
+ [[ -e /etc/redhat-release ]] && args=( $args[@]
'-r[create system group]'
'-f[force]'
)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-08 11:37 ` Oliver Kiddle
@ 2001-08-08 12:06 ` Chmouel Boudjnah
2001-08-08 15:52 ` Bart Schaefer
1 sibling, 0 replies; 14+ messages in thread
From: Chmouel Boudjnah @ 2001-08-08 12:06 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Oliver Kiddle <okiddle@yahoo.co.uk> writes:
> Chmouel Boudjnah wrote:
> >
> > > anyone can think of a good way to detect RedHat/Mandrake, please let me
> >
> > /etc/{mandrake,redhat}-release
>
> Perfect. Thanks.
we may in the future depreciate the redhat-release link so you may {mandrake,redhat}-
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-08 11:37 ` Oliver Kiddle
2001-08-08 12:06 ` Chmouel Boudjnah
@ 2001-08-08 15:52 ` Bart Schaefer
2001-08-08 17:17 ` Oliver Kiddle
2001-08-11 14:20 ` Peter Stephenson
1 sibling, 2 replies; 14+ messages in thread
From: Bart Schaefer @ 2001-08-08 15:52 UTC (permalink / raw)
To: zsh-workers
On Aug 8, 12:37pm, Oliver Kiddle wrote:
}
} + [[ -e /etc/redhat-release ]] && args=( $args[@]
There is no reason, ever, to use $args[@].
Either ksharrays is set, in which case you need ${args[@]}, or it is not
set, in which case $args is equivalent and microscopically faster.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-08 15:52 ` Bart Schaefer
@ 2001-08-08 17:17 ` Oliver Kiddle
2001-08-09 15:58 ` Bart Schaefer
2001-08-11 14:20 ` Peter Stephenson
1 sibling, 1 reply; 14+ messages in thread
From: Oliver Kiddle @ 2001-08-08 17:17 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> There is no reason, ever, to use $args[@].
>
> Either ksharrays is set, in which case you need ${args[@]}, or it is not
> set, in which case $args is equivalent and microscopically faster.
I thought about this once ages ago but didn't mention it. I've just
followed what seems to be the convention in the completion functions. In
the functions, there are:
2 occurences of ${expl[@]}
3 occurences of $expl and
139 occurences of $expl[@]
So it is not just my fault. I had assumed that it was done this way for
a reason such as handling a strange option combination or that it was
considered more readable to have the [@] there. Maybe someone does have
a reason?
Oliver
_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-08 7:19 ` Sven Wischnowsky
@ 2001-08-08 17:23 ` Oliver Kiddle
0 siblings, 0 replies; 14+ messages in thread
From: Oliver Kiddle @ 2001-08-08 17:23 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky wrote:
>
> Yes, here is the patch. It adds the -w option to _values which means
> that it will look at all words on the line.
Cheers.
> > I'm not sure whether
> > there shouldn't be exclusions between bs and ibs/obs for dd but as the
> > exclusions don't work here, I didn't worry.
>
> You can now start to worry ;-)
There are inconsistencies between different variants of UNIX as to how a
mixture of bs and ibs/obs is handled. It doesn't make a great deal of
sense to mix them and it is generally good to cut down the number of
completions so I've put the exclusions in. I've also added exclusions
for the conversion types.
Oliver
Index: Completion/Unix/Command/_dd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_dd,v
retrieving revision 1.4
diff -u -r1.4 _dd
--- Completion/Unix/Command/_dd 2001/08/08 07:20:57 1.4
+++ Completion/Unix/Command/_dd 2001/08/08 17:19:31
@@ -1,16 +1,17 @@
#compdef dd
-local opts
-
_values -w 'option' \
'if[specify input file]:input file:_tilde_files' \
'of[specify output file]:output file:_tilde_files' \
- 'ibs[input block size]:block size (bytes)' \
- 'obs[output block size]:block size (bytes)' \
- 'bs[block size]:block size (bytes)' \
+ '(bs)ibs[input block size]:block size (bytes)' \
+ '(bs)obs[output block size]:block size (bytes)' \
+ '(ibs obs)bs[block size]:block size (bytes)' \
'cbs[conversion buffer size]:buffer size (bytes)' \
'skip[input blocks initially skipped]:blocks' \
'seek[output blocks initially skipped]:blocks' \
'files[specify number of input files to copy and concatenate]:number of files' \
'count[number of input blocks to copy]:blocks' \
- 'conv[specify conversions to apply]:conversion:_values -s , "conversion" ascii ebcdic ibm block unblock lcase ucase swab noerror sync'
+ 'conv[specify conversions to apply]:conversion:_values -s , conversion
+ "(ebcdic ibm)ascii" "(ascii ibm)ebcdic" "(ascii ebcdic)ibm"
+ "(unblock)block" "(block)unblock"
+ "(ucase)lcase" "(lcase)ucase" swab noerror sync'
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-08 17:17 ` Oliver Kiddle
@ 2001-08-09 15:58 ` Bart Schaefer
0 siblings, 0 replies; 14+ messages in thread
From: Bart Schaefer @ 2001-08-09 15:58 UTC (permalink / raw)
To: zsh-workers
On Aug 8, 6:17pm, Oliver Kiddle wrote:
} Subject: Re: PATCH: new and updated completions
}
} Bart Schaefer wrote:
}
} > There is no reason, ever, to use $args[@].
} >
} > Either ksharrays is set, in which case you need ${args[@]}, or it is not
} > set, in which case $args is equivalent and microscopically faster.
}
} I had assumed that it was done this way for a reason such as handling
} a strange option combination or that it was considered more readable
} to have the [@] there. Maybe someone does have a reason?
In the argument list of a command, it might be done just to alert the
reader that multiple arguments are potentially being provided.
In an expression like `args=( $args[@] ... )', the extra info is minimal.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH: new and updated completions
2001-08-08 15:52 ` Bart Schaefer
2001-08-08 17:17 ` Oliver Kiddle
@ 2001-08-11 14:20 ` Peter Stephenson
1 sibling, 0 replies; 14+ messages in thread
From: Peter Stephenson @ 2001-08-11 14:20 UTC (permalink / raw)
To: Zsh hackers list
"Bart Schaefer" wrote:
> On Aug 8, 12:37pm, Oliver Kiddle wrote:
> }
> } + [[ -e /etc/redhat-release ]] && args=( $args[@]
>
> There is no reason, ever, to use $args[@].
Indeed, there's no reason to use the `@' forms outside double quotes,
which is their natural habitat. There the distinction between $args and
$args[@] is important, although I tend to use ${args[@]} just for
clarity (but I tend to be inconsistent, too).
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2001-08-11 13:16 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-06 14:28 PATCH: new and updated completions Oliver Kiddle
2001-08-06 14:30 ` Chmouel Boudjnah
2001-08-06 17:43 ` Borsenkow Andrej
2001-08-06 17:47 ` Chmouel Boudjnah
2001-08-08 11:37 ` Oliver Kiddle
2001-08-08 12:06 ` Chmouel Boudjnah
2001-08-08 15:52 ` Bart Schaefer
2001-08-08 17:17 ` Oliver Kiddle
2001-08-09 15:58 ` Bart Schaefer
2001-08-11 14:20 ` Peter Stephenson
2001-08-07 10:36 ` Sven Wischnowsky
2001-08-07 11:04 ` Oliver Kiddle
2001-08-08 7:19 ` Sven Wischnowsky
2001-08-08 17:23 ` Oliver Kiddle
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).