about summary refs log tree commit diff
path: root/Completion/Unix/Type
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2005-06-08 12:45:24 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2005-06-08 12:45:24 +0000
commit0ba8ae87eac21281e0b17eb9cbb523d133067a4a (patch)
tree614cc49ce90c3c2562f83d6739f8ea76dc75d7f0 /Completion/Unix/Type
parent9181f0e3059862d2d8cc109bc849f8705cbbc23c (diff)
downloadzsh-0ba8ae87eac21281e0b17eb9cbb523d133067a4a.tar.gz
zsh-0ba8ae87eac21281e0b17eb9cbb523d133067a4a.tar.xz
zsh-0ba8ae87eac21281e0b17eb9cbb523d133067a4a.zip
21315: make completion functions give precendence to descriptions passed as
parameters and cleanup descriptons in calling functions
Diffstat (limited to 'Completion/Unix/Type')
-rw-r--r--Completion/Unix/Type/_dir_list4
-rw-r--r--Completion/Unix/Type/_domains2
-rw-r--r--Completion/Unix/Type/_file_systems8
-rw-r--r--Completion/Unix/Type/_groups2
-rw-r--r--Completion/Unix/Type/_hosts2
-rw-r--r--Completion/Unix/Type/_java_class2
-rw-r--r--Completion/Unix/Type/_locales2
-rw-r--r--Completion/Unix/Type/_perl_basepods2
-rw-r--r--Completion/Unix/Type/_perl_modules5
-rw-r--r--Completion/Unix/Type/_pids2
-rw-r--r--Completion/Unix/Type/_ports2
-rw-r--r--Completion/Unix/Type/_printers14
-rw-r--r--Completion/Unix/Type/_services18
-rw-r--r--Completion/Unix/Type/_tex2
-rw-r--r--Completion/Unix/Type/_texi2
-rw-r--r--Completion/Unix/Type/_time_zone2
-rw-r--r--Completion/Unix/Type/_users4
17 files changed, 34 insertions, 41 deletions
diff --git a/Completion/Unix/Type/_dir_list b/Completion/Unix/Type/_dir_list
index 574e8a2af..536d424e3 100644
--- a/Completion/Unix/Type/_dir_list
+++ b/Completion/Unix/Type/_dir_list
@@ -4,6 +4,8 @@
 #  -s <sep> to specify the separator (default is a colon)
 #  -S       to say that the separator should be added as a suffix (instead
 #           of the default slash)
+# any description passed should apply to an individual directory and not
+# to the entire list
 
 local sep=: dosuf suf
 
@@ -24,4 +26,4 @@ else
   suf=()
 fi
 
-_files "$suf[@]" -r "${sep}"' /\t\t\-' -/ "$@"
+_directories "$suf[@]" -r "${sep}"' /\t\t\-' "$@"
diff --git a/Completion/Unix/Type/_domains b/Completion/Unix/Type/_domains
index 42a0966dd..851ac7930 100644
--- a/Completion/Unix/Type/_domains
+++ b/Completion/Unix/Type/_domains
@@ -17,4 +17,4 @@ if ! zstyle -a ":completion:${curcontext}:domains" domains domains; then
 fi
 
 _wanted domains expl domain \
-    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a domains
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -a "$@" - domains
diff --git a/Completion/Unix/Type/_file_systems b/Completion/Unix/Type/_file_systems
index 50b3ed744..ffbf5ac68 100644
--- a/Completion/Unix/Type/_file_systems
+++ b/Completion/Unix/Type/_file_systems
@@ -10,9 +10,9 @@ case $OSTYPE in
     fss=( adfs bfs cramfs ext2 ext3 hfs hpfs iso9660 minix ntfs qnx4
           reiserfs romfs swap udf ufs vxfs xfs xiafs )
     [[ -r /proc/filesystems ]] &&
-        fss=( $fss ${$(</proc/filesystems)#nodev} )
+        fss+=( ${$(</proc/filesystems)#nodev} )
     [[ -r /etc/filesystems ]] &&
-        fss=( $fss ${$(</etc/filesystems)#nodev} )
+        fss+=( ${$(</etc/filesystems)#\*} )
   ;;
   osf*) fss=( advfs ufs nfs mfs cdfs ) ;;
   solaris*) fss=( ufs nfs hsfs s5fs pcfs cachefs tmpfs ) ;;
@@ -22,11 +22,11 @@ case $OSTYPE in
   ;;
   *)
     # default for all other systems
-    fss=( ufs)
+    fss=( ufs )
   ;;
 esac
 
-_wanted fstypes expl 'file system type' compadd "$@" -M 'L:|no=' -a fss
+_wanted fstypes expl 'file system type' compadd "$@" -M 'L:|no=' -a "$@" - fss
 
 
  
diff --git a/Completion/Unix/Type/_groups b/Completion/Unix/Type/_groups
index 6ba32f4f0..923c34599 100644
--- a/Completion/Unix/Type/_groups
+++ b/Completion/Unix/Type/_groups
@@ -21,4 +21,4 @@ if ! zstyle -a ":completion:${curcontext}:" groups groups; then
   groups=( "$_cache_groups[@]" )
 fi
 
-_wanted groups expl group compadd "$@" -a groups
+_wanted groups expl group compadd -a "$@" - groups
diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index e530c8b42..67e06f295 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -18,4 +18,4 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
 fi
 
 _wanted hosts expl host \
-    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a hosts
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -a "$@" - hosts
diff --git a/Completion/Unix/Type/_java_class b/Completion/Unix/Type/_java_class
index 1abca1291..d81669c00 100644
--- a/Completion/Unix/Type/_java_class
+++ b/Completion/Unix/Type/_java_class
@@ -20,5 +20,5 @@ for i in "${(s.:.)classpath}"; do
   fi
 done
 
-_wanted classes expl 'java class' compadd "$@" -M 'r:|.=* r:|=*' -a c
+_wanted classes expl 'java class' compadd "$@" -M 'r:|.=* r:|=*' -a - c
 
diff --git a/Completion/Unix/Type/_locales b/Completion/Unix/Type/_locales
index edc86ed78..e809667d1 100644
--- a/Completion/Unix/Type/_locales
+++ b/Completion/Unix/Type/_locales
@@ -9,4 +9,4 @@ else
   locales=( /usr/lib/locale/*(:t) )
 fi
 
-_wanted locales expl locale compadd "$@" -a locales
+_wanted locales expl locale compadd -a "$@" - locales
diff --git a/Completion/Unix/Type/_perl_basepods b/Completion/Unix/Type/_perl_basepods
index 1dbd92551..80a8c8321 100644
--- a/Completion/Unix/Type/_perl_basepods
+++ b/Completion/Unix/Type/_perl_basepods
@@ -29,4 +29,4 @@ fi
 
 local expl
 
-_wanted pods expl 'perl base pods' compadd -a - _perl_basepods
+_wanted pods expl 'perl base pod' compadd -a "$@" - _perl_basepods
diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules
index 21ebb4441..4ed06ff31 100644
--- a/Completion/Unix/Type/_perl_modules
+++ b/Completion/Unix/Type/_perl_modules
@@ -18,9 +18,6 @@
 #   modules which don't begin with an uppercase letter).
 
 _perl_modules () {
-  local opts
-  zparseopts -D -a opts S: q
-
   # Set a sensible default caching policy.  This has to be done inside
   # this function otherwise we wouldn't know the context for the style.
   local update_policy
@@ -87,7 +84,7 @@ _perl_modules () {
 
   local expl
 
-  _wanted modules expl 'Perl modules' compadd "$opts[@]" -a $perl_modules
+  _wanted modules expl 'Perl module' compadd "$@" -a - $perl_modules
 }
 
 _perl_modules_caching_policy () {
diff --git a/Completion/Unix/Type/_pids b/Completion/Unix/Type/_pids
index e20844703..18ed4616e 100644
--- a/Completion/Unix/Type/_pids
+++ b/Completion/Unix/Type/_pids
@@ -38,7 +38,7 @@ else
 fi
 
 _wanted processes expl 'process ID' \
-    compadd "$@" "$desc[@]" "$all[@]" -a pids && ret=0
+    compadd "$@" "$desc[@]" "$all[@]" -a - pids && ret=0
 
 if [[ -n "$all" ]]; then
   zstyle -s ":completion:${curcontext}:processes" insert-ids out || out=menu
diff --git a/Completion/Unix/Type/_ports b/Completion/Unix/Type/_ports
index 958917bd6..8c8da531e 100644
--- a/Completion/Unix/Type/_ports
+++ b/Completion/Unix/Type/_ports
@@ -9,4 +9,4 @@ if ! zstyle -a ":completion:${curcontext}:" ports ports; then
   ports=( "$_cache_ports[@]" )
 fi
 
-_wanted ports expl port compadd "$@" -a ports
+_wanted ports expl port compadd -a "$@" - ports
diff --git a/Completion/Unix/Type/_printers b/Completion/Unix/Type/_printers
index 02196daee..edbc9aaae 100644
--- a/Completion/Unix/Type/_printers
+++ b/Completion/Unix/Type/_printers
@@ -4,7 +4,7 @@ local expl ret=1 list disp sep tmp
 
 if (( $+commands[lsallq] )); then
   # Use AIX's command to list print queues
-  _wanted printers expl printer compadd $(lsallq)
+  _wanted printers expl printer compadd "$@" - $(lsallq)
   return
 fi
 
@@ -30,11 +30,11 @@ if (( ! $+_lp_cache )); then
           disp=''
         fi
         if [[ -n "$disp" ]]; then
-          _lp_cache=( "$_lp_cache[@]" "${names[1]}:${disp}" )
-  	_lp_alias_cache=( "$_lp_alias_cache[@]" "${(@)^names[2,-1]:#*\ *}:${disp}" )
+          _lp_cache+=( "${names[1]}:${disp}" )
+  	  _lp_alias_cache+=( "${(@)^names[2,-1]:#*\ *}:${disp}" )
         else
-          _lp_cache=( "$_lp_cache[@]" "${names[1]}" )
-  	_lp_alias_cache=( "$_lp_alias_cache[@]" "${(@)names[2,-1]:#*\ *}" )
+          _lp_cache+=( "${names[1]}" )
+  	  _lp_alias_cache+=( "${(@)names[2,-1]:#*\ *}" )
         fi
       fi
     done < $file[1]
@@ -56,7 +56,7 @@ else
   disp=()
 fi
 _wanted printers expl printer \
-    compadd "$disp[@]" - "${(@)_lp_cache%%:*}" && return 0
+    compadd "$@" "$disp[@]" - "${(@)_lp_cache%%:*}" && return 0
 
 (( $+_lp_alias_cache )) || return 1
 
@@ -67,6 +67,6 @@ else
   disp=()
 fi
 _wanted printers expl printer \
-    compadd "$disp[@]" - "${(@)_lp_alias_cache%%:*}" && return 0
+    compadd "$@" "$disp[@]" - "${(@)_lp_alias_cache%%:*}" && return 0
 
 return 1
diff --git a/Completion/Unix/Type/_services b/Completion/Unix/Type/_services
index 8e682bd52..2965e0f3e 100644
--- a/Completion/Unix/Type/_services
+++ b/Completion/Unix/Type/_services
@@ -7,18 +7,12 @@ if chkconfig --list > /dev/null 2>&1; then
   alls=( ${(f)"$(LANGUAGE=C LANG=C LC_ALL=C chkconfig --list)"} )
   inits=( ${${${alls[1,(r)xinetd based*]}[1,-2]}/%[[:space:]]*/} )
   xinetds=( ${${${${alls[(r)xinetd based*,-1]}[2,-1]}/#[[:space:]]#}/%:*} )
+
+  _alternative \
+    'init:init service:compadd -a inits' \
+    'xinetd:xinetd service:compadd -a xinetds' && ret=0
 else
-  inits=( /etc/init.d/*(-*:t) )
+  _wanted services expl service compadd "$@" - /etc/init.d/*(-*:t) && ret=0
 fi
 
-_tags init xinetd
-
-while _tags; do
-  _requested init expl 'init services' \
-    compadd  -a inits && ret=0
-  _requested xinetd expl 'xinetd services' \
-    compadd  -a xinetds && ret=0
-  (( ret )) || break
-done
-
-return $ret
+return ret
diff --git a/Completion/Unix/Type/_tex b/Completion/Unix/Type/_tex
index 0d9130930..fcbafbd67 100644
--- a/Completion/Unix/Type/_tex
+++ b/Completion/Unix/Type/_tex
@@ -3,4 +3,4 @@
 local expl
 
 _description files expl 'TeX or LaTeX file'
-_files "$expl[@]" -g '*.(tex|TEX|texinfo|texi)(-.)'
+_files "$@" "$expl[@]" -g '*.(tex|TEX|texinfo|texi)(-.)'
diff --git a/Completion/Unix/Type/_texi b/Completion/Unix/Type/_texi
index fb9c488ca..10ccfa28b 100644
--- a/Completion/Unix/Type/_texi
+++ b/Completion/Unix/Type/_texi
@@ -3,4 +3,4 @@
 local expl
 
 _description files expl 'texinfo file'
-_files "$expl[@]" -g '*.(texinfo|texi)(-.)'
+_files "$@" "$expl[@]" -g '*.(texinfo|texi)(-.)'
diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone
index 5bad7329b..cd924bbc7 100644
--- a/Completion/Unix/Type/_time_zone
+++ b/Completion/Unix/Type/_time_zone
@@ -6,4 +6,4 @@ if (( ! $+_zoneinfo_dirs )); then
   _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) )
 fi
 
-_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs
+_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" -
diff --git a/Completion/Unix/Type/_users b/Completion/Unix/Type/_users
index 08c22bbc2..de671f27d 100644
--- a/Completion/Unix/Type/_users
+++ b/Completion/Unix/Type/_users
@@ -3,6 +3,6 @@
 local expl users
 
 zstyle -a ":completion:${curcontext}:" users users &&
-    _wanted users expl user compadd "$@" -a users && return 0
+    _wanted users expl user compadd "$@" -a - users && return 0
 
-_wanted users expl user compadd "$@" -k userdirs
+_wanted users expl user compadd "$@" -k - userdirs