From abd18275a4c27bc76d26e5111b4cb9c33e2ae7d7 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 8 Jan 2003 15:14:50 +0000 Subject: 18058, 18060: merge from 4.1 --- ChangeLog | 13 +++++ Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_ant | 11 +--- Completion/Unix/Command/_lsof | 44 ++++++++++++++++ Completion/Unix/Command/_mt | 78 ++++++++++++++++++++++++++++ Completion/Unix/Command/_rlogin | 101 +++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_ssh | 4 +- Completion/Unix/Command/_xsltproc | 23 +++++++++ Completion/Zsh/Command/.distfiles | 11 ++++ Completion/Zsh/Command/_zmv | 18 +++++++ Doc/Zsh/contrib.yo | 8 +-- 11 files changed, 298 insertions(+), 14 deletions(-) create mode 100644 Completion/Unix/Command/_lsof create mode 100644 Completion/Unix/Command/_mt create mode 100644 Completion/Unix/Command/_rlogin create mode 100644 Completion/Unix/Command/_xsltproc create mode 100644 Completion/Zsh/Command/.distfiles create mode 100644 Completion/Zsh/Command/_zmv diff --git a/ChangeLog b/ChangeLog index 5dbed500b..32db47896 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-01-07 Oliver Kiddle + + * 18060: Completion/Zsh/Command/_zmv, Doc/Zsh/contrib.yo, + Completion/Zsh/Command/.distfiles: document zmv's -W option and + add a completion for zmv + + * 18058: Completion/Unix/Command/_lsof, Completion/Unix/Command/_mt, + Completion/Unix/Command/_xsltproc, Completion/Unix/Command/_rlogin, + Completion/Unix/Command/_ssh, Completion/Unix/Command/_ant, + Completion/Unix/Command/.distfiles: new completions for lsof, mt and + xsltproc, complete remote files for rcp, allow multiple port + redirections with ssh and a typo correction in _ant + 2002-12-18 Peter Stephenson * 18013: Src/builtin.c, Src/exec.c: let and (( ... )) should diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index e013f1aa2..0ba6f63db 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -18,4 +18,5 @@ _loadkeys _apm _ruby _samba _sysctl _links _user_admin _rsync _arping _spamassassin _mtools _fsh _chkconfig _cdcd _irssi _sccs _texinfo _ant _global _global_tags _figlet _ifconfig _last _larch +_lsof _mt _xsltproc ' diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index c1baf6f69..5edc6dd63 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -1,16 +1,9 @@ -#compdef ant -value-,ANT_ARGS,-default- +#compdef ant typeset -A opt_args local state line curcontext="$curcontext" local target='*:target:->target' -if [[ $service = *ANT_ARGS* ]]; then - compset -q - words=( fake "$words[@]" ) - (( CURRENT++ )) - unset target -fi - _arguments -C \ '-help[display usage information]' \ '-projecthelp[print project hjelp information]' \ @@ -25,7 +18,7 @@ _arguments -C \ '-listener[add an instance of class as a project listener]:classname:_java_class' \ '(-f -file -buildfile)'{-f,-file,-buildfile}'[use specified build file]:build file:_files' \ '*-D[specify property with value to use]:property' \ - '-propertyfile[load properties from specfied file]:property file:_files' \ + '-propertyfile[load properties from specified file]:property file:_files' \ '-inputhandler[specify class which will handle input requests]:class:_java_class' \ '-find[search for buildfile]:file:_files' \ $target && return diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof new file mode 100644 index 000000000..0e3bc7a1b --- /dev/null +++ b/Completion/Unix/Command/_lsof @@ -0,0 +1,44 @@ +#compdef lsof + +_arguments -s -S \ + '(-)'{-\?,-h}'[list help]' \ + '-a[AND selections]' \ + '-b[avoid kernel blocks]' \ + '-C[disable reporting of path name components]' \ + '-c[list files for command beginning with specified char]:char' \ + '+d[search for open instances for contents of specified dir]:search directory:_files -/' \ + '-d[specify list of file descriptors to exclude/include]:file descriptors' \ + '+D[recursively search from specified dir]:search directory:_files -/' \ + '-D[direct use of device cache file]:function:((\?\:report\ device\ cache\ file\ paths b\:build\ the\ device\ cache\ file i\:ignore\ the\ device\ cache\ file r\:read\ the\ device\ cache\ file u\:read\ and\ update\ the\ device\ cache\ file))' \ + '-f[inhibit listing of kernel file structure info]::info type or path' \ + '+f[enable listing of kernel file structure info]::info type' \ + '-F[select output fields]:fields' \ + '-g[select by process group id]::process group id' \ + '*-i[select internet files]:address' \ + '-k[specify kernel name list file]:kernel file:_files' \ + '-l[inhibit conversion of UIDs to user names]' \ + '-L[list no link counts]' \ + '+L[list all link counts]::max link count for listed files' \ + '-m[specify kernel memory file]:kernel memory file:_files' \ + '-M[disable reporting of portmapper registrations]' \ + '+M[enable reporting of portmapper registrations]' \ + '-n[inhibit conversion of network numbers to hostnames]' \ + '-N[select listing of NFS files]' \ + '(-s)-o[list file offset]' \ + '-O[avoid overheads of bypassing potential blocking]' \ + '-P[inhibit conversion of port numbers to port names]' \ + '-p[list files for specified processes]:processes:_pids' \ + '-r[repeat listing endlessly]::delay (seconds)' \ + '+r[repeat listing until no files listed]::delay (seconds)' \ + '-R[list parent PID]' \ + '(-o)-s[list file size]' \ + '-S[specify timeout for kernel functions that might deadlock]:timeout (seconds)' \ + '-T[select reporting of TCP/TPI info]::info type:((q\:queue\ length\ reporting s\:state\ reporting w\:window\ size\ reporting))' \ + '(+w -w)-t[terse output]' \ + '-u[list files owned by specified users]:user list:_users' \ + '-U[list Unix domain socket files]' \ + '(-)-v[list version info]' \ + '-V[indicate unsuccessfully searched for items]' \ + '(-t)+w[suppress warnings]' \ + '(-t)-w[enable warnings]' \ + '*:file:_files' diff --git a/Completion/Unix/Command/_mt b/Completion/Unix/Command/_mt new file mode 100644 index 000000000..8d2689539 --- /dev/null +++ b/Completion/Unix/Command/_mt @@ -0,0 +1,78 @@ +#compdef mt + +local -a args cmds +local state line curcontext="$curcontext" + +args=( '(-)-f[specify raw tape device]:tape device:_files' ) +cmds=( + {eof,weof}':write specified number of EOF marks at current position' + 'fsf:forward space by specified number of files' + 'fsr:forward space by specified number of records' + 'bsf:backward space by specified number of files' + 'bsr:backward space by specified number of records' + 'asf:absolute space to specified file number' + 'eom:go to end of recorded media on the tape' + 'rewind:rewind the tape' + {offline,rewoffl}':rewind and unload the tape' + 'status:print status information about the tape unit' + 'retension:rewind, wind to end of reel, rewind again - smoothes tape tension' + 'erase:erase the tape' +) + +if [[ $OSTYPE = linux* ]]; then + args=( + '(1 2 -)'{-V,--version}'[print version info]' + '(1 2 -)--help[display usage info]' + '(-V --version --help -f --file)'{-f,--file=}'[specify raw tape device]:tape device:_files' + '(-V --version --help)--rsh-command=[specify remote shell command]:rsh command:_command_names -e' + ) + # should really allow remote user@host for tape device + cmds=( $cmds + 'bsfm:backward space by specified number of file marks' + 'fsfm:forward space by specified number of file marks' + 'fss:forward space by specified number of setmarks' + 'bss:backward space by specified number of setmarks' + 'wset:write specified number of setmarks at current position' + {eod,seod}':space to end of valid data' + 'setblk:set drive block size' + 'setdensity:set tape density code' + 'drvbuffer:set drive buffer code' + 'stoptions:set driver option bits' + 'stwrthreshold:set device write threshold' + 'seek:seek to specified block' + 'tell:tell the current block on tape' + 'densities:explain some common density codes' + 'datcompression:enquire or set compression status' + ) +elif [[ $OSTYPE = freebsd* ]]; then + cmds=( ${cmds:#(asf|eof):*} + 'smk:write specified number of setmarks at current position' + 'fss:forward space by specified number of setmarks' + 'bss:backward space by specified number of setmarks' + 'rdhpos:read hardware block position' + 'rdspos:read SCSI logical block position' + 'sethpos:set hardware block position' + 'setspos:set SCSI logical block position' + 'errstat:print error status info about device' + 'blocksize:set drive block size' + 'density:set tape density code' + 'geteotmodel:print the current EOT filemark model' + 'seteotmodel:set the current EOT filemark model' + 'eod:go to end of recorded media on the tape' + 'comp:set compression mode' + ) +elif [[ $OSTYPE = solaris* ]]; then + cmds=( $cmds + 'nbsf:back space by specified number of files positioning at file start' + 'reserve:allow drive to remain reserved after close until explicit release' + 'release:re-establish release at close behaviour' + ) + if (( ! EUID )); then + cmds=( $cmds 'forcereserve:break reservation of tape drive held by other host' ) + fi +fi + +_arguments -C "$args[@]" '(--help --version -V)1:operation:->operation' \ + '2:count:' && return + +[[ -n "$state" ]] && _describe -t operations 'operation' cmds diff --git a/Completion/Unix/Command/_rlogin b/Completion/Unix/Command/_rlogin new file mode 100644 index 000000000..522af7f4c --- /dev/null +++ b/Completion/Unix/Command/_rlogin @@ -0,0 +1,101 @@ +#compdef rlogin rsh remsh=rsh rcp + +_rcp_remote_files () { + # There should be coloring based on all the different ls -F classifiers. + local expl remfiles remdispf remdispd suf ret=1 + + if zstyle -T ":completion:${curcontext}:" remote-access; then + remfiles=(${(M)${(f)"$(rsh ${words[CURRENT]%%:*} ls -d1F ${PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)}) + compset -P '*/' + compset -S '/*' || suf='remote file' + + remdispf=(${remfiles:#*/}) + remdispd=(${(M)remfiles:#*/}) + + _tags files + while _tags; do + while _next_label files expl ${suf:-remote directory}; do + [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ + ${remdispf%[*=@|]} && ret=0 + compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ + ${remdispd%/} && ret=0 + done + (( ret )) || return 0 + done + else + _message 'remote file' + fi +} + +_rlogin () { + case "$service" in + rlogin) + _arguments -s \ + '-8[allow 8-Bit data]' \ + '-e-[specify escape character]:escape character:' \ + '-l[specify login user name]:login as:_rlogin_users' \ + ':remote host name:_rlogin_hosts' + ;; + rsh|remsh) + local context state line ret=1 + typeset -A opt_args + + _arguments -s \ + '-n[ignore stdin]' \ + '-l[specify login user name]:login as:_rlogin_users' \ + ':remote host name:_rlogin_hosts' \ + '(-):command: _command_names -e' \ + '*::command:->command' && ret=0 + + if [[ -n "$state" ]]; then + shift 1 words + (( CURRENT-- )) + _normal && ret=0 + fi + return ret + ;; + rcp) + local curcontext="$curcontext" state line ret=1 expl + typeset -A opt_args + + _arguments -C -s \ + '-p[preserve modification times]' \ + '-r[recursively copy directories]' \ + '*:files:->files' && ret=0 + + if [[ -n "$state" ]]; then + if compset -P '*:'; then + _rcp_remote_files && ret=0 + elif compset -P '*@'; then + _wanted hosts expl host _rlogin_hosts -S: && ret=0 + else + _alternative \ + 'files:: _files' \ + 'hosts:: _rlogin_all_hosts -S:' \ + 'users:: _rlogin_users -qS@' && ret=0 + fi + fi + return ret + ;; + esac +} + +_rlogin_users () { + _tags users && _combination -s '[:@]' my-accounts users-hosts users "$@" +} + +_rlogin_hosts () { + _tags hosts && + if [[ "$IPREFIX" == *@ ]]; then + _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" + else + _combination -s '[:@]' my-accounts users-hosts \ + ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" + fi +} + +_rlogin_all_hosts () { + _tags hosts && _combination -s '[:@]' my-accounts users-hosts hosts "$@" +} + +_rlogin "$@" diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 9d56feae9..4c2eef7cc 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -70,8 +70,8 @@ _ssh () { '-V[show version number]' \ '(-X)-x[disable X11 forwarding]' \ '(-x)-X[enable X11 forwarding]' \ - '-L[specify local port forwarding]:local port forwarding:->forward' \ - '-R[specify remote port forwarding]:remote port forwarding:->forward' \ + '*-L[specify local port forwarding]:local port forwarding:->forward' \ + '*-R[specify remote port forwarding]:remote port forwarding:->forward' \ ':remote host name:->userhost' \ '*::args:->command' "$common[@]" && ret=0 ;; diff --git a/Completion/Unix/Command/_xsltproc b/Completion/Unix/Command/_xsltproc new file mode 100644 index 000000000..ff83c735e --- /dev/null +++ b/Completion/Unix/Command/_xsltproc @@ -0,0 +1,23 @@ +#compdef xsltproc + +_arguments \ + '(-)'{--version,-V}'[show libxml and libxslt versions]' \ + '(--verbose -v)'{--verbose,-v}"[show logs of what's happening]" \ + '(--output -o)'{--output,-o}'[specify output file]:output file:_files' \ + '--timing[display the time used]' \ + '--repeat[run the transformation 20 times]' \ + '--debug[dump the tree of the result instead]' \ + '--dumpextensions[dump registered extension elements and functions]' \ + '--novalid[skip the DTD loading phase]' \ + '--noout[do not dump the result]' \ + '--maxdepth[increase the maximum depth]:depth' \ + '(--docbook)--html[input document is an HTML file]' \ + '(--html)--docbook[input document is SGML docbook]' \ + '--param[pass a parameter,value pair]:name::value (xpath expression)' \ + '--stringparam[pass a parameter]:name::value' \ + '--nonet[refuse to fetch DTDs or entities over network]' \ + '--catalogs[use SGML catalogs]' \ + '--xinclude[do XInclude processing on document input]' \ + {--profile,--norman}'[dump profiling information]' \ + '1:stylesheet:_files -g \*.xsl' \ + ':file:_files -g \*.xml' diff --git a/Completion/Zsh/Command/.distfiles b/Completion/Zsh/Command/.distfiles new file mode 100644 index 000000000..dae8c4016 --- /dev/null +++ b/Completion/Zsh/Command/.distfiles @@ -0,0 +1,11 @@ +DISTFILES_SRC=' +.distfiles +_autoload _disable _kill _sched _typeset _zed +_bindkey _echotc _mere _set _unhash _zftp +_builtin _emulate _precommand _setopt _unsetopt _zle +_cd _enable _print _source _wait _zmodload +_command _fc _prompt _stat _which _zpty +_compdef _hash _read _trap _zcompile _zstyle +_echoti _ttyctl _ulimit _vared _alias _jobs_builtin +_zmv +' diff --git a/Completion/Zsh/Command/_zmv b/Completion/Zsh/Command/_zmv new file mode 100644 index 000000000..bc639f3ec --- /dev/null +++ b/Completion/Zsh/Command/_zmv @@ -0,0 +1,18 @@ +#compdef zmv zln zcp + +_arguments -s -S -A '-*' \ + '(-C -L -s -p)-M[force mv]' \ + '(-M -L -s -p)-C[force cp]' \ + '(-M -C -p)-L[force ln]' \ + '-f[force overwriting of destination files]' \ + '-i[interactive: prompt for each operation]' \ + '-n[no execution: just print what would happen]' \ + '-Q[force bare glob qualifiers on]' \ + '(-C -M)-s[symbolic, passed down to ln]' \ + '-v[verbose: print line as it is executed]' \ + '-o[specify options to pass to underlying command]: opt string' \ + '(-M -C -L -s)-p+[specify program to run instead of cp, ln or mv]:program:_command_names -e' \ + '(-W)-w[implicitly add parenthesis to wildcards in the pattern]' \ + '(-w)-W[like -w, but turn wildcards in replacement patterns into references]' \ + '1:source pattern:_files' \ + '2:desination pattern:_files' diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 1c42fccb8..d727ef8c8 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -812,8 +812,8 @@ not exist; it is created on write, if necessary. ) findex(zcp) findex(zln) -xitem(tt(zcp) [ tt(-finqQvw) ] var(srcpat) var(dest)) -item(tt(zln) [ tt(-finqQsvw) ] var(srcpat) var(dest))( +xitem(tt(zcp) [ tt(-finqQvwW) ] var(srcpat) var(dest)) +item(tt(zln) [ tt(-finqQsvwW) ] var(srcpat) var(dest))( Same as tt(zmv -C) and tt(zmv -L), respectively. These functions do not appear in the zsh distribution, but can be created by linking tt(zmv) to the names tt(zcp) and tt(zln) in some directory in your tt(fpath). @@ -824,7 +824,7 @@ ifzman(above)\ ifnzman((noderef(Utilities))). ) findex(zmv) -item(tt(zmv) [ tt(-finqQsvw) ] [ -C | -L | -M | -p var(program) ] [ -o var(optstring) ] var(srcpat) var(dest) )( +item(tt(zmv) [ tt(-finqQsvwW) ] [ -C | -L | -M | -p var(program) ] [ -o var(optstring) ] var(srcpat) var(dest) )( Move (usually, rename) files matching the pattern var(srcpat) to corresponding files having names of the form given by var(dest), where var(srcpat) contains parentheses surrounding patterns which will be @@ -859,6 +859,8 @@ sitem(tt(-s))(Symbolic, passed down to tt(ln); only works with tt(-L).) sitem(tt(-v))(Verbose: print each command as it's being executed.) sitem(tt(-w))(Pick out wildcard parts of the pattern, as described above, and implicitly add parentheses for referring to them.) +sitem(tt(-W))(Just like tt(-w), with the addition of turning wildcards in +the replacement pattern into sequential ${1} .. ${N} references.) sxitem(tt(-C)) sxitem(tt(-L)) sitem(tt(-M))(Force tt(cp), tt(ln) or tt(mv), respectively, regardless of -- cgit 1.4.1