From 79323d6d41c91860cd05800a06cf8076df5051bd Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 15 Mar 2002 16:26:08 +0000 Subject: 16842: resolve name clash for nc between netcat and the nedit client for completion and add _pick_variant to resolve program variants in general --- Completion/Unix/Command/_cpio | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'Completion/Unix/Command/_cpio') 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) = *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' -- cgit v1.2.3