about summary refs log tree commit diff
path: root/Completion/Unix/Command/_cpio
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-03-15 16:26:08 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-03-15 16:26:08 +0000
commit79323d6d41c91860cd05800a06cf8076df5051bd (patch)
tree0c08a2486422faa6f805589f2f60f640134b455b /Completion/Unix/Command/_cpio
parent2fa33574f029358dc1597b1ff8700385d7c8332a (diff)
downloadzsh-79323d6d41c91860cd05800a06cf8076df5051bd.tar.gz
zsh-79323d6d41c91860cd05800a06cf8076df5051bd.tar.xz
zsh-79323d6d41c91860cd05800a06cf8076df5051bd.zip
16842: resolve name clash for nc between netcat and the nedit client for
completion and add _pick_variant to resolve program variants in general
Diffstat (limited to 'Completion/Unix/Command/_cpio')
-rw-r--r--Completion/Unix/Command/_cpio26
1 files changed, 8 insertions, 18 deletions
diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio
index 61c4d76ac..280a8930f 100644
--- a/Completion/Unix/Command/_cpio
+++ b/Completion/Unix/Command/_cpio
@@ -1,33 +1,23 @@
 #compdef cpio
 
-(( $+_is_gnu )) || typeset -gA _is_gnu
-
-local cmd=$service args ig curcontext="$curcontext" state line
+local args ig curcontext="$curcontext" state line
 local expl ret
 local fmts='(bar bin odc newc crc tar ustar hpbin hpodc)'
 
-if (( ! $+_is_gnu[$cmd] )); then
-  if [[ $(_call_program version $cmd --version </dev/null 2>/dev/null) = *GNU* ]]
-  then
-    _is_gnu[$cmd]=yes
-  else
-    _is_gnu[$cmd]=
-  fi
-fi 
-ig=$_is_gnu[$cmd]
+_pick_variant -r ig gnu=GNU unix --version
 
-if (( $CURRENT == 2 )); then
+if (( CURRENT == 2 )); then
    # Complete arguments 
    args=('-o[create archive]' '-i[extract from archive]'
    '-p[run as filter on directory tree]')
-   [[ -n $ig ]] && args=($args '--create[create archive]'
+   [[ $ig = gnu ]] && args=($args '--create[create archive]'
    '--extract[extract from archive]' 
    '--pass-through[run as filter on directory tree]'
    '--help[show help text]' '--version[show version information]')
 else
   if [[ -n ${words[(r)(-o*|-[^-]*o*|--create)]} ]]; then
-    # Optiona for creating archive
-    if [[ -n $ig ]]; then
+    # Options for creating archive
+    if [[ $ig = gnu ]]; then
 	args=(
 	   '--file=:archive file:->afile'
 	   "--format=:format type:$fmts"
@@ -51,7 +41,7 @@ else
 	  '-O[set output archive file]:output archive file:_files'
 	 )
   elif [[ -n ${words[(r)(-i*|-[^-]*i*|--extract)]} ]]; then
-    if [[ -n $ig ]]; then
+    if [[ $ig = gnu ]]; then
       args=('--file=:archive file:->afile'
 	    "--format=:format type:$fmts"
 	    '--make-directories' '--nonmatching' 
@@ -90,7 +80,7 @@ else
 	  '*:pattern to extract'
 	  )
   elif [[ -n ${words[(r)(-p*|-[^-]*p*|--pass-through)]} ]]; then
-    if [[ -n $ig ]]; then
+    if [[ $ig = gnu ]]; then
       args=('--null' '--reset-access-time' '--make-directories'
             '--link' '--quiet' '--preserve-modification-time'
 	    '--unconditional' '--verbose' '--dot' '--dereference'