zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: various completion functions
@ 2001-03-11 21:48 Oliver Kiddle
  2001-03-12  0:46 ` lftp completion Chmouel Boudjnah
  2001-03-12  1:01 ` PATCH: various completion functions Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Oliver Kiddle @ 2001-03-11 21:48 UTC (permalink / raw)
  To: Zsh workers

I've made a few additions and updates to some completion functions as
follows:

_mutt, _xargs - added descriptions for options
_urls - fixed bug where suf was not declared local and handle port nos
_tar, _subscript, _files - local variables not declared thus
_tags - remove two redundant lines
_hosts, _webbrowser, _urls - augment list of commands handled
_wget - complete new options in Wget 1.6
_fetchmail, _iconv, _ncftp, _zip - new
_dir_list - handle suffixes
mere - use shwordsplit for MANPAGER so it works as man does, allowing
    arguments to the pager.

Am I correct in removing the two lines from _tags. targs was something I
identified when finding variables which were not declared local in
completion functions. I can't see anywhere that reads it's value so I'm
guessing that it is a left over from the past and isn't needed.

Oliver


Index: Completion/Base/_subscript
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_subscript,v
retrieving revision 1.4
diff -u -r1.4 _subscript
--- Completion/Base/_subscript	2000/10/10 14:12:21	1.4
+++ Completion/Base/_subscript	2001/03/11 22:46:38
@@ -1,6 +1,6 @@
 #compdef -subscript-
 
-local expl osuf=']'
+local expl ind osuf=']'
 
 if [[ "$1" = -q ]]; then
   osuf='] '
Index: Completion/Core/_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_files,v
retrieving revision 1.15
diff -u -r1.15 _files
--- Completion/Core/_files	2000/10/05 07:31:00	1.15
+++ Completion/Core/_files	2001/03/11 22:46:38
@@ -1,6 +1,7 @@
 #autoload
 
 local opts tmp glob pat pats expl tag i def descr end ign ret=1 match tried
+local type sdef
 
 zparseopts -a opts \
     '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+:
Index: Completion/Core/_tags
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_tags,v
retrieving revision 1.7
diff -u -r1.7 _tags
--- Completion/Core/_tags	2000/10/12 08:28:27	1.7
+++ Completion/Core/_tags	2001/03/11 22:46:39
@@ -24,8 +24,6 @@
   elif [[ "$1" = -C ]]; then
     curcontext="${curcontext%:*}:${2}"
     shift 2
-  else
-    targs=()
   fi
 
   [[ "$1" = -(|-) ]] && shift
Index: Completion/User/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/.distfiles,v
retrieving revision 1.17
diff -u -r1.17 .distfiles
--- Completion/User/.distfiles	2001/03/08 12:03:34	1.17
+++ Completion/User/.distfiles	2001/03/11 22:46:39
@@ -1,13 +1,14 @@
 DISTFILES_SRC='
     .distfiles
-    _a2ps _apachectl _archie _arp _bison _bzip2 _chown _compress
-    _configure _cvs _dd _dict _diff _diff_options _dir_list _dirs
-    _domains _dvi _enscript
-    _find _finger _fakeroot _flex _gcc _gdb  _getconf _gprof _grep _groups
-    _gs _gv _gzip _hosts _imagemagick _init_d _ispell
-    _java _joe _killall _lp _look _ls _lynx _lzop
+    _a2ps _apachectl _archie _arp _bison _bzip2
+    _chown _compress _configure _cvs
+    _dd _dict _diff _diff_options _dir_list _dirs _domains _dvi
+    _enscript _find _finger _fakeroot _fetchmail _flex
+    _gcc _gdb  _getconf _gprof _grep _groups _gs _gv _gzip
+    _hosts _imagemagick _iconv _init_d _ispell
+    _java _joe _killall _look _lp _ls _lynx _lzop
     _mailboxes _make _man _mere _mh _mount _mutt _my_accounts _mysql_utils
-    _nedit _netscape _newsgroups _nslookup _other_accounts
+    _ncftp _nedit _netscape _newsgroups _nslookup _other_accounts
     _pack _patch _pbm _pdf _perl _perl_basepods _perl_builtin_funcs
     _perl_modules _perldoc _ports _prcs _printers _prompt _ps _pspdf
     _psutils _rcs _rlogin
@@ -15,5 +16,5 @@
     _tar _tar_archive _telnet _tex _texi _tiff _tilde_files _tin
     _urls _use_lo _user_at_host _users _users_on
     _w3m _webbrowser _wget _whereis _whois _xargs _yodl _yp
-    _zcat _zdump
+    _zcat _zdump _zip
 '
Index: Completion/User/_dir_list
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_dir_list,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _dir_list
--- Completion/User/_dir_list	1999/08/23 10:07:44	1.1.1.1
+++ Completion/User/_dir_list	2001/03/11 22:46:39
@@ -1,4 +1,7 @@
 #autoload
 
+local suf
+
 compset -P '*:'
-_files -S: -r ': \t\t\-' -/
+compset -S ':*' || suf=":"
+_files -S "$suf" -r ': \t\t\-' -/
Index: Completion/User/_fetchmail
===================================================================
RCS file: _fetchmail
diff -N _fetchmail
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ _fetchmail	Sun Mar 11 14:46:39 2001
@@ -0,0 +1,11 @@
+#compdef fetchmail
+
+_arguments \
+  {--bsmtp,'(--logfile)-L','(-L)--logfile','(--fetchmailrc)-f','(-f)--fetchmailrc','(--idfile)-i','(-i)--idfile'}':file:_files' \
+  {--plugin,--plugout,'(--mda)-m','(-m)--mda'}':command:_command_names -e' \
+  {'(--username)-u','(-u)--username'}:user:_users \
+  '--auth:authentication types:(password kerberos kerberos_v5)' \
+  {'(--protocol)-p','(-p)--protocol'}:protocol:'(auto pop2 pop3 apop rpop kpop sdps imap imap-k4 imap-gss etrn)' \
+  {'(--port)-P','(-P)--port'}':port number' \
+  '*:mail server:_hosts' \
+  --
Index: Completion/User/_hosts
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_hosts,v
retrieving revision 1.2
diff -u -r1.2 _hosts
--- Completion/User/_hosts	2000/05/31 09:38:26	1.2
+++ Completion/User/_hosts	2001/03/11 22:46:39
@@ -1,4 +1,4 @@
-#compdef ftp ncftp ping rwho rup xping traceroute host
+#compdef ftp ping rwho rup xping traceroute host lftp
 
 local expl hosts
 
Index: Completion/User/_iconv
===================================================================
RCS file: _iconv
diff -N _iconv
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ _iconv	Sun Mar 11 14:46:39 2001
@@ -0,0 +1,54 @@
+#compdef iconv
+
+local expl curcontext="$curcontext" state line codeset LOCPATH
+
+(( $+_is_gnu )) || typeset -gA _is_gnu
+if (( ! $+_is_gnu[$words[1]] )); then
+  if [[ $(_call version $words[1] --version </dev/null 2>/dev/null) = *GNU* ]]; 
+  then
+    _is_gnu[$words[1]]=yes
+  else
+    _is_gnu[$words[1]]=
+  fi
+fi
+
+if [[ -n "$_is_gnu[$words[1]]" ]]; then
+
+  _arguments -C \
+    {'(--from-code --list)-f','(-f --list)--from-code='}'[specify code set of input file]:code set:->codeset' \
+    {'(--to-code --list)-t','(-t --list)--to-code='}'[specify code set for output]:code set:->codeset' \
+    '--list[list all character code sets]' \
+    '--verbose[print progress information]' \
+    {'(--help)-\?','(-\?)--help'}'[display help information]' \
+    '--usage[display a short usage message]' \
+    {'(--version)-V','(-V)--version'}'[print program version]' \
+    '1:file:_files' && return 0
+    
+    if [[ $state = codeset ]]; then
+      _wanted codesets expl 'code set' \
+          compadd "$@" ${${(s:,:)$(iconv --list|sed -n '/^$/,$ p')}## #}
+    fi
+    
+else
+
+  _arguments -C \
+    '-f[specify code set of input file]:code set:->codeset' \
+    '-t[specify code set for output]:code set:->codeset' \
+    '1:file:_files' && return 0
+
+    if [[ $state = codeset ]]; then
+      if [[ -f /usr/lib/iconv/iconv_data ]]; then  # IRIX & Solaris
+	codeset=( ${${(f)"$(</usr/lib/iconv/iconv_data)"}%%[[:blank:]]*} )
+      elif [[ -d ${LOCPATH:=/usr/lib/nls/loc}/iconv ]]; then  # OSF
+	codeset=( $LOCPATH/iconv/*(N:t) )
+	codeset=( ${(j:_:s:_:)codeset} )
+      else
+	return 1
+      fi
+	
+      _wanted codesets expl 'code set' compadd "$@" -a codeset
+    fi
+
+fi    
+    
+    
Index: Completion/User/_mutt
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_mutt,v
retrieving revision 1.3
diff -u -r1.3 _mutt
--- Completion/User/_mutt	2000/07/22 04:39:46	1.3
+++ Completion/User/_mutt	2001/03/11 22:46:39
@@ -1,38 +1,39 @@
 #compdef mutt
 
-local curcontext="$curcontext" state line ret=1
+local curcontext="$curcontext" state line suf
 typeset -A opt_args
 
-_arguments -C \
+_arguments -C -s \
     '::recipient:->userhost' \
-    '*-a:MIME attachment:_files' \
-    '*-b:BCC recipient:->userhost' \
-    '*-c:CC recipient:->userhost' \
-    '-e:post-init configuration:' \
-    '-f+:mailbox: _mailboxes' \
-    '-F+:init file:_files' \
-    '-h+:help:' \
-    '-H+:draft file:_files' \
-    '-i:include file:_files' \
-    '-m+:default mailbox type:(mbox MMDF MH Maildir)' \
-    '-n+:bypass system configuration:' \
-    '-p+:resume postponed message:' \
-    '-R+:open in read-only mode:' \
-    '-s+:subject:' \
-    '-v+:version:' \
-    '-x+:emulate mailx compose:' \
-    '-y+:start listing mailboxes:' \
-    '-z+:start only if new messages:' \
-    '-Z+:open first mailbox with new mail:' && ret=0
+    '*-a[attach file using MIME]:file attachment:_files' \
+    '*-b[specify a BCC recipient]:BCC recepient:->userhost' \
+    '*-c[specify a CC recipient]:CC recipient:->userhost' \
+    '-e+[specify a post-init configuration command]:post-init configuration:' \
+    '-f+[specify mailbox to load]:mailbox: _mailboxes' \
+    '-F+[specify an init file]:init file:_files' \
+    '-h[display help]' \
+    '-H+[specify a draft file for message]:draft file:_files' \
+    '-i+[specify file to include in message]:include file:_files' \
+    '-m+[specify default mailbox type]:mailbox type:(mbox MMDF MH Maildir)' \
+    '-n[bypass system configuration]' \
+    '-p[resume postponed message]' \
+    '-R[open in read-only mode]' \
+    '-s+[specify a subject]:subject:' \
+    '-v[display mutt version]' \
+    '-x[emulate mailx compose]' \
+    '-y[start listing mailboxes]' \
+    '-z[start only if new messages]' \
+    '-Z[open first mailbox with new mail]' && return 0
 
 if [[ "$state" = userhost ]]; then
   if compset -P '*@'; then
     _description hosts expl 'remote host name'
     _hosts "$expl[@]" -q -S, && return 0
   else
+    compset -S '@*' || suf='@'
     _description users expl 'login name'
-    _users "$expl[@]" -q -S@ && return 0
+    _users "$expl[@]" -q -S "$suf" && return 0
   fi
 fi
 
-return ret
+return 1
Index: Completion/User/_ncftp
===================================================================
RCS file: _ncftp
diff -N _ncftp
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ _ncftp	Sun Mar 11 14:46:39 2001
@@ -0,0 +1,8 @@
+#compdef ncftp
+
+if [[ -f ~/.ncftp/bookmarks ]]; then
+  _wanted bookmarks expl bookmark \
+      compadd - $(awk -F, 'NR > 2 { print $1 }' ~/.ncftp/bookmarks) && return 0
+fi
+
+_hosts
Index: Completion/User/_tar
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_tar,v
retrieving revision 1.1.1.17
diff -u -r1.1.1.17 _tar
--- Completion/User/_tar	2000/03/23 04:19:30	1.1.1.17
+++ Completion/User/_tar	2001/03/11 22:46:41
@@ -13,7 +13,7 @@
 #    tar itself (GNU tar)
 #  - Things like --directory=... are also completed correctly.
 
-local _tar_cmd tf tmp del
+local _tar_cmd tf tmp tmpb del
 
 # First we collect in `_tar_cmd' single letter options describing what
 # should be done with the archive and if it is compressed. This
Index: Completion/User/_urls
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_urls,v
retrieving revision 1.15
diff -u -r1.15 _urls
--- Completion/User/_urls	2001/02/01 15:48:58	1.15
+++ Completion/User/_urls	2001/03/11 22:46:41
@@ -1,4 +1,4 @@
-#compdef curl
+#compdef curl galeon
 
 # Usage: _urls [-f]
 # Options:
@@ -38,7 +38,7 @@
 #    E.g.:
 #      zstyle ':completion:*:urls' local www /usr/local/apache/htdocs public_html
 
-local ipre scheme host user uhosts ret=1 expl match glob
+local ipre scheme host user uhosts ret=1 expl match glob suf
 local urls_path localhttp
 zstyle -s ":completion:${curcontext}:urls" path urls_path ||
     urls_path="${ZDOTDIR:-$HOME}/.zsh/urls"
@@ -118,22 +118,24 @@
 esac
 
 # Complete hosts
-if ! compset -P '(#b)([^/]#)/'; then
+if ! compset -P '(#b)([^:/]#)([:/])'; then
   uhosts=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t))
 
   _tags hosts
   while _tags; do
     while _next_label hosts expl host "$@"; do
-      compset -S '/*' || suf="/"
-      (( $#uhosts )) || _hosts -S "$suf" "$expl[@]" && ret=0
+      compset -S '[:/]*' || suf="/"
+      (( $#uhosts )) || _hosts -S "$suf" -r '/:' "$expl[@]" && ret=0
       [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
-      compadd -S "$suf" "$expl[@]" -a uhosts && ret=0
+      compadd -S "$suf" -r '/:' "$expl[@]" -a uhosts && ret=0
     done
     (( ret )) || return 0
   done
   return 1
 fi
 host="$match[1]"
+
+[[ $match[2] = ':' ]] && ! compset -P '<->/' && _message 'port number' && return 0
 
 # Complete part after hostname
 
Index: Completion/User/_webbrowser
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_webbrowser,v
retrieving revision 1.2
diff -u -r1.2 _webbrowser
--- Completion/User/_webbrowser	2001/03/06 19:43:55	1.2
+++ Completion/User/_webbrowser	2001/03/11 22:46:41
@@ -1,3 +1,3 @@
-#compdef amaya arena chimera express grail gzilla hotjava mmm mozilla www xmosaic Mosaic
+#compdef amaya arena chimera express grail gzilla hotjava mmm mozilla opera www xmosaic Mosaic
 
 _urls -f
Index: Completion/User/_wget
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_wget,v
retrieving revision 1.2
diff -u -r1.2 _wget
--- Completion/User/_wget	2000/05/05 13:38:46	1.2
+++ Completion/User/_wget	2001/03/11 22:46:42
@@ -18,6 +18,8 @@
   '*-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' \
+  '--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' \
@@ -27,6 +29,7 @@
   '--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 retieval:' \
   {'(--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' \
@@ -34,10 +37,13 @@
   '--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' \
   '--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:' \
   '--retr-symlinks' \
@@ -47,17 +53,22 @@
   {'(--level)-l+[level]','(-l)--level='}':level:(0)' \
   '--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' \
-  {'(--accept)-A+[accept]','(-A)--accept='}':accepted etensions:' \
-  {'(--reject)-R+[reject]','(-R)--reject='}':rejected etensions:' \
+  '(--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:' \
   '--exclude-domains=:rejected domains:' \
-  '(--relative)-L[relative]' '(-L)--relative' \
   '--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:' \
-  {'(--base)-B+[base]','(-B)--base='}':base:' \
   '--no-host-lookup' \
   '--no-parent' \
   '--non-verbose' \
Index: Completion/User/_xargs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_xargs,v
retrieving revision 1.2
diff -u -r1.2 _xargs
--- Completion/User/_xargs	2000/05/03 14:44:01	1.2
+++ Completion/User/_xargs	2001/03/11 22:46:42
@@ -1,13 +1,15 @@
 #compdef xargs
 
 _arguments \
-  -{p,t,x} \
+  '(-t)-p[prompt user for each command]' \
+  '(-p)-t[verbose - echo each command]' \
+  '-x[exit if max size exceeded]' \
   -{e-,E}':end-of-file string:' \
   '(-x -I)-i-:replacement string for lines:' \
   '(-x -i)-I:replacement string for lines:' \
   '(-n -L -x)-l-:number of input lines:' \
   '(-n -l)-L:number of input lines:' \
-  '(-l -L)-n:maximum number of arguments:' \
-  '-s:maximum command line length:' \
+  '(-l -L)-n-:maximum number of arguments:' \
+  '-s-:maximum command line length:' \
   '(-):command: _command_names -e' \
   '*::args: _normal'
Index: Completion/User/_zip
===================================================================
RCS file: _zip
diff -N _zip
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ _zip	Sun Mar 11 14:46:42 2001
@@ -0,0 +1,121 @@
+#compdef zip unzip zipinfo
+
+local suffixes suf zipfile izip
+local expl curcontext="$curcontext" state line
+typeset -A opt_args
+
+case $service in
+  zip)
+    _arguments -C -s \
+      '-f[freshen: only changed files]' \
+      '-d[delete entries in zipfile]' \
+      '-R[recurse into directories]' \
+      '-q[quiet operation]' \
+      '-c[add one-line comments]' \
+      '-b[use "path" for temp file]:path for temporary archive:_files -/' \
+      '-@[read names from stdin]' \
+      '-F[fix zipfile]' \
+      '-FF[try harder to fix zipfile]' \
+      '-A[adjust self-extracting exe]' \
+      '-T[test zipfile integrity]' \
+      '-y[store symbolic links as the link instead of the referenced file]' \
+      '-e[encrypt]' \
+      '-h[show help]' \
+      '-u[update: only changed or new files]' \
+      '-m[move into zipfile (delete files)]' \
+      '-g[allow growing existing zipfile]' \
+      '-j[junk: do not record directory names]' \
+      '-l[convert LF to CR LF]' \
+      '-ll[convert CR LF to LF]' \
+      '-L[display license]' \
+      '-v[verbose operation/print version info]' \
+      '-z[add zipfile comment]' \
+      '-t[only do files after or at "mmddyyyy"]:mmddyyyy' \
+      '-tt[only do files before "mmddyyyy"]:mmddyyyy' \
+      '-o[make zipfile as old as latest entry]' \
+      '-D[do not add directory entries]' \
+      '-J[junk zip file prefix (unzipsfx)]' \
+      '-X[eXclude eXtra file attributes]' \
+      '-n[specify suffixes of files not to be compressed]:suffixes:->suffixes' \
+      '(   -1 -2 -3 -4 -5 -6 -7 -8 -9)-0[store only]' \
+      '(-0    -2 -3 -4 -5 -6 -7 -8 -9)-1[compress faster]' \
+      '(-0 -1    -3 -4 -5 -6 -7 -8 -9)-2' \
+      '(-0 -1 -2    -4 -5 -6 -7 -8 -9)-3' \
+      '(-0 -1 -2 -3    -5 -6 -7 -8 -9)-4' \
+      '(-0 -1 -2 -3 -4    -6 -7 -8 -9)-5' \
+      '(-0 -1 -2 -3 -4 -5    -7 -8 -9)-6' \
+      '(-0 -1 -2 -3 -4 -5 -6    -8 -9)-7' \
+      '(-0 -1 -2 -3 -4 -5 -6 -7    -9)-8' \
+      '(-0 -1 -2 -3 -4 -5 -6 -7 -8   )-9[compress better]' \
+      '-x[exclude the following names]' \
+      '-i[include only the following names]' \
+      "(-f -d -R -q -c -b -@ -F -FF -A -T -y -e -h -u -m -g -j -l -ll -L -v -z -t -tt -o -D -J -X -n -0 -1 -2 -3 -4 -5 -6 -7 -8 -9):zip file:_files -g '(#i)*.(zip|[jw]ar)'" \
+      ':file:->files' && return 0
+  ;;
+  unzip)
+    _arguments -C -s \
+      '(-f -u -l -t -z -d)-p[extract files to pipe]' \
+      '(-p -u -l -t -z)-f[freshen existing files; create none]' \
+      '(-p -f -l -t -z)-u[update files; create if necessary]' \
+      '(-p -f -u -t -z -d)-l[list files]' \
+      '(-p -f -u -l -z -d)-t[test compressed archive data]' \
+      '(-p -f -u -l -t -d)-z[display archive comment]' \
+      '(-p -l -t -z)-d+[specify directory to extract files to]:directory:_files -/' \
+      '(-p -l -t -z -o)-n[never overwrite existing files]' \
+      '(-p -l -t -z -n)-o[overwrite files without prompting]' \
+      "(-p -l -t -z)-j[junk paths (don't make directories)]" \
+      '-C[match filenames case-insensitively]' \
+      '(-p -l -t -z)-X[restore UID/GID info]' \
+      '-q[quiet]' '-qq[quieter]' \
+      '(-l -t -z)-a[auto-convert any text files]' \
+      '(-l -t -z)-aa[treat all files as text]' \
+      '-v[verbose/display version info]' \
+      '(-p -z)-L[lowercase (some) filenames]' \
+      '-M[page output]' \
+      '-x[exclude the following names]' \
+      "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|[jw]ar)'" \
+      '*:file:->files' && return 0
+  ;;
+  zipinfo)
+    _arguments -C -s \
+      '(-2 -s -m -l -v -h -t -T -z)-1[filenames only]' \
+      '(-1 -s -m -l -v -T)-2[just filenames but allow -h/-t/-z]' \
+      '(-1 -2 -m -l -v -h -t)-s[short format]' \
+      '(-1 -2 -s -l -v -h -t)-m[medium format]' \
+      '(-1 -2 -s -m -v -h -t)-l[long format]' \
+      '(-1 -2 -s -m -l -h -z)-v[verbose, multi-page format]' \
+      '(-1 -s -m -l -v)-h[print header line]' \
+      '(-1 -v)-z[print zipfile comment]' \
+      '-C[match filenames case-insensitively]' \
+      '(-1 -s -m -l)-t[print totals]' \
+      '(-1 -2)-T[use sortable decimal format for file times]' \
+      '-M[page output]' \
+      '-x[exclude the following names]' \
+      "(-1 -2 -s -m -l -v -h -z -C -t -T -M)1:zip file:_files -g '(#i)*.(zip|[jw]ar)'" \
+      '*:file:->files' && return 0
+  ;;
+esac
+
+case $state in
+  suffixes)
+    compset -P '*:'
+    compset -S ':*' || suf=":"
+    suffixes=( *.*(N:e) )
+    _wanted suffixes expl suffixes compadd -S "$suf" -r " " .$^suffixes && return 0
+  ;;
+  files)
+    if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
+      _files -g '^(#i)*.(zip|[jw]ar)' && return 0
+    else
+      (( izip = 1 + words[(I)-[^xi]*] ))
+      (( izip == 1 )) && (( izip++ ))
+      zipfile=( $~words[izip](|.zip|.ZIP) )
+      [[ -z $zipfile[1] ]] && return 1
+      if [[ $zipfile[1] !=  $_zip_cache_list ]]; then
+	_zip_cache_name="$zipfile[1]"
+	_zip_cache_list=( $(zipinfo -1 $_zip_cache_name) )
+      fi
+     _wanted files expl 'file from archive' _multi_parts / _zip_cache_list
+    fi
+  ;;
+esac
Index: Functions/Misc/mere
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Misc/mere,v
retrieving revision 1.2
diff -u -r1.2 mere
--- Functions/Misc/mere	2000/12/15 14:42:24	1.2
+++ Functions/Misc/mere	2001/03/11 22:46:48
@@ -80,4 +80,4 @@
   fi |
   nroff -T$terminal -man | $col -x
 ) |
-${MANPAGER:-${PAGER:-more}} -s
+${=MANPAGER:-${PAGER:-more}} -s


^ permalink raw reply	[flat|nested] 6+ messages in thread

* lftp completion
  2001-03-11 21:48 PATCH: various completion functions Oliver Kiddle
@ 2001-03-12  0:46 ` Chmouel Boudjnah
  2001-03-13  5:24   ` Bart Schaefer
  2001-03-12  1:01 ` PATCH: various completion functions Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Chmouel Boudjnah @ 2001-03-12  0:46 UTC (permalink / raw)
  To: zsh-workers


--- /dev/null   Thu Mar  8 11:12:32 2001
+++ Completion/User/_lftp       Mon Mar 12 01:44:31 2001
@@ -0,0 +1,5 @@
+#compdef lftp
+if [[ -f ~/.lftp/bookmarks ]]; then
+  _wanted bookmarks expl bookmark \
+      compadd - $(cut -f1 ~/.lftp/bookmarks) && return 0
+fi

-- 
MandrakeSoft Inc                     http://www.chmouel.org
                      --Chmouel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: various completion functions
  2001-03-11 21:48 PATCH: various completion functions Oliver Kiddle
  2001-03-12  0:46 ` lftp completion Chmouel Boudjnah
@ 2001-03-12  1:01 ` Bart Schaefer
  1 sibling, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2001-03-12  1:01 UTC (permalink / raw)
  To: Zsh workers

On Mar 11,  9:48pm, Oliver Kiddle wrote:
} Subject: PATCH: various completion functions
}
} Am I correct in removing the two lines from _tags. targs was something I
} identified when finding variables which were not declared local in
} completion functions. I can't see anywhere that reads it's value so I'm
} guessing that it is a left over from the past and isn't needed.

Either it's a leftover, or it's supposed to be zeroing the __targs local
declared in _wanted.  As far as I can tell your change is correct, but
Sven should probably confirm.

-- 
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] 6+ messages in thread

* Re: lftp completion
  2001-03-12  0:46 ` lftp completion Chmouel Boudjnah
@ 2001-03-13  5:24   ` Bart Schaefer
  2001-03-13 14:54     ` Chmouel Boudjnah
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2001-03-13  5:24 UTC (permalink / raw)
  To: zsh-workers

Chmouel's _lftp function is very similar to _ncftp.  Here's a single
function that handles both, without resorting to "awk -F" or "cut":

---- 8< ---- snip ---- 8< ----
#compdef ncftp lftp

local bookmarks=$HOME/.${words[0]:t}/bookmarks

if [[ -f $bookmarks ]]; then
  bookmarks=(${"${(f)$(<$bookmarks)}"%%[[:space:],]*})
  [[ ${words[0]:t} == ncftp ]] && shift 2 bookmarks  
  _wanted bookmarks expl bookmark compadd -a bookmarks && return 0
fi

_hosts
---- 8< ---- snip ---- 8< ----

Any object to replacing _ncftp with the above and removing _lftp?  (One
possible objection might be that lftp allows commas in its bookmark
names; I don't know whether or not that's the case.)

-- 
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] 6+ messages in thread

* Re: lftp completion
  2001-03-13  5:24   ` Bart Schaefer
@ 2001-03-13 14:54     ` Chmouel Boudjnah
  0 siblings, 0 replies; 6+ messages in thread
From: Chmouel Boudjnah @ 2001-03-13 14:54 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

"Bart Schaefer" <schaefer@candle.brasslantern.com> writes:

> Chmouel's _lftp function is very similar to _ncftp.  Here's a single
> function that handles both, without resorting to "awk -F" or "cut":

look ok for me..

-- 
MandrakeSoft Inc                     http://www.chmouel.org
                      --Chmouel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lftp completion
@ 2001-03-15 18:43 Oliver Kiddle
  0 siblings, 0 replies; 6+ messages in thread
From: Oliver Kiddle @ 2001-03-15 18:43 UTC (permalink / raw)
  To: zsh-workers

Sven wrote:

> How about a compromise: check if $HOME/.${words[0]:t}/bookmarks exists 
> and if it doesn't, fall back on $HOME/$service/bookmarks.

We could do that or we could use Bart's function with the style but I
think it would be better not to bother. As it stands,  it works for
lftp and ncftp. If we find other similar commands, then  we can think
about it all then. The most likely other candidates I can think of for
using this function are ncftpget, ncftpput and zftp which will all just
screw up either suggestion anyway.

The ncftp completion as committed by me on Sunday was not something I 
sat down to do a decent job of but was something which had been lying
in my functions directory for months and got committed because I was
doing a clear out and decided that it was more useful than default
completion. In fact, I seem to remember that it is a cut 'n' paste job
from _zftp. I've just looked at _zftp and it seems to be using the
bookmarks themselves so could use _ncftp. I was previously under the
impression that _zftp was taking full hostnames from the ncftp
bookmarks.

I think the whole host name completion thing possibly needs a bit of
thought. I've never really looked at all the _my_accounts and other,
similar mechanisms, I've only got a hosts style for _hosts. I'll need
to think about it more and look at some of the existing stuff but it
might be useful to have an _ftphosts which uses lftp, ncftp, zftp
bookmarks etc. What might be better is if _hosts takes various
parameters which specify things like: this is a
telnet/rsh/ftp/ssh/whatever connection or I've specified a user of
'opk' so only list hosts for which these users/connection types are
applicable, and an option to suggest inclusion of ncftp bookmarks.
_hosts could then use the parameters in combination with a few styles.
If anyone has any ideas, (including if you think it is all fine as it
is, let me know).

Oliver

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre. For further information visit
http://www.messagelabs.com/stats.asp


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-03-15 18:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-11 21:48 PATCH: various completion functions Oliver Kiddle
2001-03-12  0:46 ` lftp completion Chmouel Boudjnah
2001-03-13  5:24   ` Bart Schaefer
2001-03-13 14:54     ` Chmouel Boudjnah
2001-03-12  1:01 ` PATCH: various completion functions Bart Schaefer
2001-03-15 18:43 lftp completion 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).