Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: completion updates



Just a clear out of some of the completion function updates I have.
Patch contains new completions for lsof, mt and xsltproc. A spelling
correction in _ant, _ssh should allow for multiple port forwardings and
I copied the remote file part of _scp over for _rcp.

Oliver

Index: Completion/Unix/Command/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/.distfiles,v
retrieving revision 1.29
diff -u -r1.29 .distfiles
--- Completion/Unix/Command/.distfiles	3 Sep 2002 12:32:59 -0000	1.29
+++ Completion/Unix/Command/.distfiles	6 Jan 2003 17:45:16 -0000
@@ -18,5 +18,5 @@
 _user_admin   _rsync        _arping	  _spamassassin _mtools       _ifconfig
 _fsh          _chkconfig    _cdcd         _irssi        _mysqldiff    _sccs
 _netcat       _larch        _texinfo	_figlet
-_global       _global_tags  _ant
+_global       _global_tags  _ant          _lsof         _mt           _xsltproc
 '
Index: Completion/Unix/Command/_ant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v
retrieving revision 1.3
diff -u -r1.3 _ant
--- Completion/Unix/Command/_ant	24 Aug 2002 19:19:14 -0000	1.3
+++ Completion/Unix/Command/_ant	6 Jan 2003 17:45:16 -0000
@@ -27,7 +27,7 @@
   '*-listener[add an instance of class as a project listener]:classname:_java_class -cp ${(j.:.)c}' \
   '(-f -file -buildfile -find)'{-f,-file,-buildfile}'[use specified build file]:build file:_files' \
   '*-D[specify property with value to use]:property:->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 -cp ${(j.\:.)c}' \
   '(-f -file -buildfile)-find[search for build file towards the root of filesystem]:build file:(build.xml)' \
   $target && return
Index: Completion/Unix/Command/_lsof
===================================================================
RCS file: Completion/Unix/Command/_lsof
diff -N Completion/Unix/Command/_lsof
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_lsof	6 Jan 2003 17:45:16 -0000
@@ -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'
Index: Completion/Unix/Command/_mt
===================================================================
RCS file: Completion/Unix/Command/_mt
diff -N Completion/Unix/Command/_mt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_mt	6 Jan 2003 17:45:16 -0000
@@ -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 _pick_variant gnu=GNU unix --version; 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+=(
+    '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+=(
+    '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+=( '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
Index: Completion/Unix/Command/_rlogin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rlogin,v
retrieving revision 1.1
diff -u -r1.1 _rlogin
--- Completion/Unix/Command/_rlogin	2 Apr 2001 12:01:21 -0000	1.1
+++ Completion/Unix/Command/_rlogin	6 Jan 2003 17:45:16 -0000
@@ -1,5 +1,32 @@
 #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 -e remote-files 'remote file'
+  fi
+}
+
 _rlogin () {
   case "$service" in
   rlogin)
@@ -38,7 +65,7 @@
 
     if [[ -n "$state" ]]; then
       if compset -P '*:'; then
-	_files && ret=0
+	_rcp_remote_files && ret=0
       elif compset -P '*@'; then
         _wanted hosts expl host _rlogin_hosts -S: && ret=0
       else
Index: Completion/Unix/Command/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v
retrieving revision 1.17
diff -u -r1.17 _ssh
--- Completion/Unix/Command/_ssh	6 Sep 2002 06:19:57 -0000	1.17
+++ Completion/Unix/Command/_ssh	6 Jan 2003 17:45:16 -0000
@@ -70,8 +70,8 @@
       '-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
     ;;
Index: Completion/Unix/Command/_xsltproc
===================================================================
RCS file: Completion/Unix/Command/_xsltproc
diff -N Completion/Unix/Command/_xsltproc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_xsltproc	6 Jan 2003 17:45:16 -0000
@@ -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'

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