From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22873 invoked by alias); 5 Dec 2014 15:03:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33861 Received: (qmail 20730 invoked from network); 5 Dec 2014 15:03:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1417791470; bh=Avc4n13HS9FO2dkvXel4sjxL1PNU3XZuZlJAZIoZe8w=; h=From:To:Subject:Date:From:Subject; b=sDS2gTdHo6GxgV4Kui9ny1BcVijlieLtMCyr2vkU6rRKTNac0EVcZBDKut+LmCJNBOTHIPMIS14ITaRvvlz4eRm6ScZRUqlVG6Xr6P7/uo8bEpdAfg87RCvR0t/uJAcTDnrjKfuP1JDKVE/W2fY1nY5v0aWmiGLAW0pWir2zWCIQrInWmzSBvLbg1d29zfFBbFVj1IKy36oMli+ktNIyu6HNnTjt/J2p0BHVmpHM5Y3D87azUldhMM947LrFcMJCUmBpIGvHEuqu/lQNLDCPoMZsO4KALPzQYbE03rG2ry+i/2SaBcmUdXZ9lU811ngLQqSo0OoZxF2hKjbRsLgMSw== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=i+tZUtaPXbTq3GxO/rVxUAnZJq+86lGzA0a7tmNEwz/TU0Ed/qDG6bykdf9PMRzwlQ2TTwLabFRBqIdhUUwdGttmdnCacwK9vaKBGxL9Hdy+5oSkMrAZ2/tnF916rkuACH6yXJIaQiHrULHCU3pU2D3hSfr2SzpXCyC+VzIld+yh9abUjWk96EF4b0w6jxxGhEYlhuWnQR+E6kzGUd2uXiSHEkzuqvRVrgl5ZVRSSGgjZbQ9aBsm0XcN13Cpg2/l0Aj5hnrzDdpwcQQo2J7SBMaRmgh+vA3fK1UKBF5jVlO//lQ9hUuujW/pUlkLAUqQwbN6KpdR4TOd1/HeaCnkog==; X-Yahoo-Newman-Id: 191708.51190.bm@smtp120.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: ctvKZNQVM1nCQemWYfXyhFVm5ofZDMrAy.Ce.1Z6cNA12Ye LMRALA4O1gdF2oxxZfpJ2mvcr_Aedvk36DNXRNa276arzle8rcBhf0qW2qss jORn9AP2qDRtaTjbWpE59Q64wacFNUy40RkhcvojjN.wfy4OORxU29Qwf7E4 2Tyh5igJbuSvYlkKGOF6e0HcjBmIeR6cFAMF1kq30beJIiMoFT_Rs2wYGXGv sSW6xCEtfW6OHp.PI3_AdB5H5e5.U1Ih4trpz76yv69BhxjFRyAC90INrNPQ G1dotlPuBz7xfugQ7ZwIkhabbEmTJUicpVOlG.0KnIhUfKmIZByS.mssyvej eWpJZ7wKryj7uTXgajLPRvFd2YMjoUkfnz6WNeaCESTVe6yh3kgqU8aDse59 Nt2sfMZ5dXZ.96lwZb8AGotVt1.IItiPQ7PZ2VjBHf1q2rKdUq3HfVtM0.aY x9Z4OVqU3vDE1WfRyLNLve_jgjATYVIz5nGZdjgfVjezzyoBm3wgZvfXusYU xY4QNNJbt4TNJu9a7FYwyGJBc75W81A-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- From: Oliver Kiddle To: Zsh workers Subject: PATCH: lsof completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21967.1417791468.1@thecus.kiddle.eu> Date: Fri, 05 Dec 2014 15:57:48 +0100 Message-ID: <21968.1417791468@thecus.kiddle.eu> This updates the lsof completion for new options. Oliver diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof index aca9963..c12b991 100644 --- a/Completion/Unix/Command/_lsof +++ b/Completion/Unix/Command/_lsof @@ -1,20 +1,35 @@ #compdef lsof -_arguments -s -S \ +local curcontext="$curcontext" state line fields args + +case $OSTYPE in + linux*) args=( '-X[skip reporting of info on network connections]' ) ;; + solaris*) + args=( + '-X[include deleted files]' + '-z[zone information]::zone:_zones' + ) + ;; +esac + +_arguments -C -s -S $args \ '(-)'{-\?,-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' \ + '+c[truncate command name to specified characters]:characters' \ + '-c[list files with specified command name beginning]:command name' \ '+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[specify list of file descriptors to exclude/include]:file descriptors:->filedes' \ '+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' \ + '*-+e[exempt filesystem from blocking kernel calls]:file system:_directories' \ + '-f[inhibit listing of kernel file structure info]::info type or path:(c f g G n)' \ + '+f[enable listing of kernel file structure info]::info type:(c f g G n)' \ + '-F[select output fields]:fields:->fields' \ '-g[select by process group id]::process group id' \ '*-i[select internet files]:address' \ + '-K[select listing of tasks of processes]' \ '-k[specify kernel name list file]:kernel file:_files' \ '-l[inhibit conversion of UIDs to user names]' \ '-L[list no link counts]' \ @@ -24,10 +39,10 @@ _arguments -s -S \ '+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]' \ + '(-s)-o[list file offset]::digits for file offset' \ '-O[avoid overheads of bypassing potential blocking]' \ '-P[inhibit conversion of port numbers to port names]' \ - '-p[list files for specified processes]:process ID:_pids' \ + '-p[list files for specified processes]:process ID:_sequence -s , _pids' \ '-r[repeat listing endlessly]::delay (seconds)' \ '+r[repeat listing until no files listed]::delay (seconds)' \ '-R[list parent PID]' \ @@ -41,4 +56,19 @@ _arguments -s -S \ '-V[indicate unsuccessfully searched for items]' \ '(-t)+w[suppress warnings]' \ '(-t)-w[enable warnings]' \ - '*:file:_files' + '-x[cross filesystems/traverse symlinks with +d/+D]::type:((f\:filesystems s\:symlinks))' \ + '*:file:_files' && return + +case $state in + fields) + fields=( ${${${${(f)"$($words[1] -F \? 2>&1)"}[2,-1]#??}// ##/:}:#(#s)[${PREFIX:-:}]:*} ) + compset -P '*' + _describe -t fields "field" fields -S '' && return + ;; + filedes) + _sequence -s , _wanted -x file-descriptors expl "file descriptor" compadd - \ + cwd err jld ltz mem mmap pd rtd tr txt v86 && return + ;; +esac + +return 1