diff options
Diffstat (limited to 'Completion/User')
34 files changed, 211 insertions, 105 deletions
diff --git a/Completion/User/_a2ps b/Completion/User/_a2ps index 26f4d200e..956e5a0ff 100644 --- a/Completion/User/_a2ps +++ b/Completion/User/_a2ps @@ -22,18 +22,18 @@ if [[ "$words[1]" != "$_a2ps_cache_cmd" ]]; then ) fi -_long_options -t '*\*' '(yes no)' \ - '*=DIRECTION' '(rows columns)' \ - '*=TYPE' '(r n nr rn any)' \ - '--highlight-level*' '(none normal heavy)' \ - '--version-control*' '(none off t numbered nil +_long_options -t '*\*:toggle:(yes no)' \ + '*=DIRECTION:direction:(rows columns)' \ + '*=TYPE:type:(r n nr rn any)' \ + '--highlight-level*:highlight:(none normal heavy)' \ + '--version-control*:version control:(none off t numbered nil existing never simple)' \ - '--pretty-print*' "[${_a2ps_cache_values[1]}]" \ - '--encoding*' "(${_a2ps_cache_values[2]})" \ - '--medium*' "[${_a2ps_cache_values[3]}]" \ - '--prologue*' "[${_a2ps_cache_values[4]}]" \ - '--ppd*' "[${_a2ps_cache_values[5]}]" \ - '--printer*' "[${_a2ps_cache_values[6]}]" \ - '--user-option*' "[${_a2ps_cache_values[7]}]" \ - '--variable*' "[${_a2ps_cache_values[8]}]" || + "--pretty-print*:style:[${_a2ps_cache_values[1]}]" \ + "--encoding*:encoding:(${_a2ps_cache_values[2]})" \ + "--medium*:medium:[${_a2ps_cache_values[3]}]" \ + "--prologue*:prologue:[${_a2ps_cache_values[4]}]" \ + "--ppd*:printer description:[${_a2ps_cache_values[5]}]" \ + "--printer*:printer:[${_a2ps_cache_values[6]}]" \ + "--user-option*:user option:[${_a2ps_cache_values[7]}]" \ + "--variable*:variable:[${_a2ps_cache_values[8]}]" || _files -F fignore -g '*~*.(ps|PS|eps|EPS)' diff --git a/Completion/User/_bunzip2 b/Completion/User/_bunzip2 index f544c8c27..53f4388bc 100644 --- a/Completion/User/_bunzip2 +++ b/Completion/User/_bunzip2 @@ -1,3 +1,6 @@ #compdef bunzip2 bzcat -_files -g '*.bz2' +local expl + +_description expl 'compressed file' +_files "$expl[@]" -g '*.bz2' diff --git a/Completion/User/_bzip2 b/Completion/User/_bzip2 index faf9f2501..15dd6f090 100644 --- a/Completion/User/_bzip2 +++ b/Completion/User/_bzip2 @@ -1,3 +1,6 @@ #compdef bzip2 -_files -g '*~*.bz2' +local expl + +_description expl 'file to compress' +_files "$expl[@]" -g '*~*.bz2' diff --git a/Completion/User/_chown b/Completion/User/_chown index 1ec76b39e..c75dbc4b3 100644 --- a/Completion/User/_chown +++ b/Completion/User/_chown @@ -4,10 +4,14 @@ if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then if [[ $words[1] = chgrp ]] || compset -P '*[:.]'; then _groups else + local expl + + _description expl user + if [[ $OSTYPE = (solaris*|hpux*) ]]; then - compgen -u -S ':' -q + compgen "$expl[@]" -u -S ':' -q else - compgen -u -S '.' -q + compgen "$expl[@]" -u -S '.' -q fi fi else diff --git a/Completion/User/_colors b/Completion/User/_colors index 369a4365f..346142eea 100644 --- a/Completion/User/_colors +++ b/Completion/User/_colors @@ -1,5 +1,7 @@ #autoload +local expl + if (( ! $+_color_cache )); then local file @@ -17,4 +19,6 @@ if (( ! $+_color_cache )); then fi fi -compadd -M 'm:{a-z}={A-Z} m:-=\ r:|[ A-Z0-9]=* r:|=*' - "$_color_cache[@]" +_description expl 'color specification' +compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} m:-=\ r:|[ A-Z0-9]=* r:|=*' - \ + "$_color_cache[@]" diff --git a/Completion/User/_compress b/Completion/User/_compress index 84ed42fb2..24363be07 100644 --- a/Completion/User/_compress +++ b/Completion/User/_compress @@ -1,3 +1,6 @@ #compdef compress -_files -g '*~*.Z' +local expl + +_description expl 'file to compress' +_files "$expl[@]" -g '*~*.Z' diff --git a/Completion/User/_configure b/Completion/User/_configure index 01c12dd62..5861682d0 100644 --- a/Completion/User/_configure +++ b/Completion/User/_configure @@ -5,5 +5,5 @@ _long_options -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \ #--enable- --disable- #--with- --without- #--without- --with-)' \ - '*=(E|)PREFIX*' '_files -/' \ - '*=PROGRAM*' '_command_names' + '*=(E|)PREFIX*:prefix directory:_files -/' \ + '*=PROGRAM*:program:_command_names' diff --git a/Completion/User/_cursors b/Completion/User/_cursors index 7e5cbc44e..59ecb5976 100644 --- a/Completion/User/_cursors +++ b/Completion/User/_cursors @@ -1,5 +1,7 @@ #autoload +local expl + if (( ! $+_cursor_cache )); then local file @@ -12,4 +14,5 @@ if (( ! $+_cursor_cache )); then fi fi -compadd -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]" +_description expl 'cursor name' +compadd "$@" "$expl[@]" -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]" diff --git a/Completion/User/_dd b/Completion/User/_dd index e57074520..9bcdc876d 100644 --- a/Completion/User/_dd +++ b/Completion/User/_dd @@ -1,12 +1,21 @@ #compdef dd +local expl + if compset -P 1 'conv\='; then # If there's a comma present, ignore up to the last one. The # test alone will have that effect. compset -p '*,' - compadd -qS, -q ascii ebcdic ibm block unblock lcase ucase swab noerror sync -elif compset -P 1 '[io]f\='; then - _files + _description expl conversion + compadd "$expl[@]" -qS, -q \ + ascii ebcdic ibm block unblock lcase ucase swab noerror sync +elif compset -P 1 'if\='; then + _description expl 'input file' + _files "$expl[@]" +elif compset -P 1 'of\='; then + _description expl 'output file' + _files "$expl[@]" else - compadd -S '=' if of ibs obs bs cbs skip files seek count conv + _description expl option + compadd "$expl[@]" -S '=' if of ibs obs bs cbs skip files seek count conv fi diff --git a/Completion/User/_find b/Completion/User/_find index de8c3bff9..20e8f4ff7 100644 --- a/Completion/User/_find +++ b/Completion/User/_find @@ -1,27 +1,32 @@ #compdef find -local prev="$words[CURRENT-1]" +local prev="$words[CURRENT-1]" expl if compset -N '-(ok|exec)' '\;'; then _normal -elif compset -P 1 -; then - compadd daystart {max,min,}depth follow noleaf version xdev \ - {a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \ - {i,}{l,}name {no,}{user,group} path perm regex size true uid used \ - exec {f,}print{f,0,} ok prune ls +elif [[ "$PREFIX" = -* ]]; then + _description expl option + compadd "$expl[@]" - -daystart -{max,min,}depth -follow -noleaf \ + -version -xdev -{a,c,}newer -{a,c,m}{min,time} -empty -false \ + -{fs,x,}type -gid -inum -links -{i,}{l,}name -{no,}{user,group} \ + -path -perm -regex -size -true -uid -used -exec -{f,}print{f,0,} \ + -ok -prune -ls elif [[ CURRENT -eq 2 ]]; then local ret=1 - compgen -g '. ..' && ret=0 - _files -g '*(-/)' && ret=0 + _description expl directory + compgen "$expl[@]" -g '. ..' && ret=0 + _files -/ && ret=0 return ret elif [[ "$prev" = -((a|c|)newer|fprint(|0|f)) ]]; then _files elif [[ "$prev" = -fstype ]]; then - compadd ufs 4.2 4.3 nfs tmp mfs S51K S52K + _description expl 'file system type' + compadd "$expl[@]" ufs 4.2 4.3 nfs tmp mfs S51K S52K elif [[ "$prev" = -group ]]; then - compgen -k groups + _groups elif [[ "$prev" = -user ]]; then - compgen -u + _description expl user + compgen "$expl[@]" -u fi diff --git a/Completion/User/_gdb b/Completion/User/_gdb index ff54e6a07..1dba7819d 100644 --- a/Completion/User/_gdb +++ b/Completion/User/_gdb @@ -3,33 +3,38 @@ # This uses the configuration keys `ps_args' and `ps_listargs' # described in the `_wait' function. -local cur="$words[CURRENT]" prev w list ret=1 +local cur="$words[CURRENT]" prev w list ret=1 expl -_long_options -t '*=(CORE|SYM)FILE' '_files' \ - '*=EXECFILE' '_files *(*)' \ - '*=TTY' 'compadd /dev/tty*' && return 0 +_long_options -t '*=(CORE|SYM)FILE:core file:_files' \ + '*=EXECFILE:executable:_files *(*)' \ + '*=TTY:terminal device:compadd /dev/tty*' && return 0 if compset -P '-(cd|directory)='; then _files -/ elif compset -P '-tty='; then - compadd - /dev/tty* + _description expl 'terminal device' + compadd "$expl[@]" - /dev/tty* elif compset -P '-(exec|se)='; then - _files -/g '*(*)' + _description expl executable + _files "$expl[@]" -/g '*(*)' elif compset -P '-(symbols|core|command)='; then _files -elif compset -P -; then - compadd -QS '' - symbols\= exec\= se\= core\= command\= directory\= \ - cd\= tty\= - compadd - help h s e c x d nx n quiet q batch fullname f b +elif [[ "$PREFIX" = -* ]]; then + _description expl option + compadd "$expl[@]" -QS '' - symbols\= exec\= se\= core\= command\= \ + directory\= cd\= tty\= + compadd "$expl[@]" - help h s e c x d nx n quiet q batch fullname f b else prev="$words[CURRENT-1]" case "$prev" in (-d) _files -/ && return 0 ;; - (-e) _files -/g '*(*)' && return 0 ;; (-[csx]) _files && return 0 ;; - (-b) compadd -V baud 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \ - 9600 19200 38400 57600 115200 230400 && return 0 ;; + (-e) _description expl executable + _files "$expl[@]" -/g '*(*)' && return 0 ;; + (-b) _description -V expl 'baud rate' + compadd "$expl[@]" 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \ + 9600 19200 38400 57600 115200 230400 && return 0 ;; esac w=( "${(@)words[2,-1]}" ) while [[ "$w[1]" = -* ]]; do @@ -39,12 +44,14 @@ else if [[ $#w -gt 1 ]]; then _files && ret=0 + _description expl 'process ID' list=("${(F)${(@Mr:COLUMNS-1:)${(f)$(ps ${compconfig[ps_listargs]:-$compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]*${w[1]:t}}} ") - compadd -y list - ${${${(M)${(f)"$(ps $compconfig[ps_args] 2>/dev/null)"}:#*${w[1]:t}*}## #}%% *} && ret=0 + compadd "$expl[@]" -y list - ${${${(M)${(f)"$(ps $compconfig[ps_args] 2>/dev/null)"}:#*${w[1]:t}*}## #}%% *} && ret=0 return ret else + _description expl executable _files -/g '*(*)' fi fi diff --git a/Completion/User/_groups b/Completion/User/_groups index 975189174..61f63596e 100644 --- a/Completion/User/_groups +++ b/Completion/User/_groups @@ -1,6 +1,9 @@ #compdef newgrp +local expl + : ${(A)groups:=${${(s: :)$(</etc/group)}%%:*}} # : ${(A)groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use NIS -compadd $groups +_description expl group +compadd "$@" "$expl[@]" - $groups diff --git a/Completion/User/_gunzip b/Completion/User/_gunzip index 7868e0c24..78e62c4cc 100644 --- a/Completion/User/_gunzip +++ b/Completion/User/_gunzip @@ -1,3 +1,6 @@ #compdef gunzip zcat -_files -g '*.[gG][z]' +local expl + +_description expl 'compressed file' +_files "$expl[@]" -g '*.[gG][z]' diff --git a/Completion/User/_gzip b/Completion/User/_gzip index 59e74a441..8cd4d746e 100644 --- a/Completion/User/_gzip +++ b/Completion/User/_gzip @@ -1,3 +1,6 @@ #compdef gzip +local expl + +_description expl 'file to compress' _files -g '*~*.[gG][zZ]' diff --git a/Completion/User/_hosts b/Completion/User/_hosts index d498425bc..6b2f350aa 100644 --- a/Completion/User/_hosts +++ b/Completion/User/_hosts @@ -1,5 +1,8 @@ #compdef ftp ncftp ping rwho rup xping traceroute nslookup telnet +local expl + : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} -compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" - "$hosts[@]" +_description expl host +compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$hosts[@]" diff --git a/Completion/User/_make b/Completion/User/_make index e9ee7979f..4c6095e95 100644 --- a/Completion/User/_make +++ b/Completion/User/_make @@ -1,6 +1,6 @@ #compdef make gmake pmake -local prev="$words[CURRENT-1]" file ret=1 +local prev="$words[CURRENT-1]" file ret=1 expl if [[ "$prev" = -[CI] ]]; then _files -/ @@ -18,7 +18,8 @@ else file='' fi + _description expl 'make target' [[ -n "$file" ]] && - compadd - $(awk '/^[a-zA-Z0-9][^\/ ]+:/ {print $1}' FS=: $file) && ret=0 + compadd "$expl[@]" - $(awk '/^[a-zA-Z0-9][^\/ ]+:/ {print $1}' FS=: $file) && ret=0 (( ret )) && { compset -P 1 '*\='; _files } fi diff --git a/Completion/User/_man b/Completion/User/_man index 1a175506c..049fa7db7 100644 --- a/Completion/User/_man +++ b/Completion/User/_man @@ -2,7 +2,7 @@ setopt localoptions rcexpandparam -local rep +local rep expl if [[ $words[2] = (<->*|ln) ]]; then rep=( $manpath/(man|cat)${words[2]}/$PREFIX*$SUFFIX.<->*(N:t:r) ) @@ -10,4 +10,5 @@ else rep=( $manpath/(man|cat)*/$PREFIX*$SUFFIX.<->*(N:t:r) ) fi -(( $#rep )) && compadd - $rep +_description expl 'manual page' +(( $#rep )) && compadd "$expl[@]" - $rep diff --git a/Completion/User/_mh b/Completion/User/_mh index f03e3d827..3a2e53794 100644 --- a/Completion/User/_mh +++ b/Completion/User/_mh @@ -8,7 +8,7 @@ local mymhdir=~/Mail local mhlib=/usr/lib/mh -local prev="$words[CURRENT-1]" +local prev="$words[CURRENT-1]" expl # To be on the safe side, check this exists and if not, get it anyway. [[ -d $mymhdir ]] || mymhdir=$(mhpath +) @@ -17,7 +17,8 @@ if compset -P 1 -; then # get list of options, which MH commands can generate themselves # awk is just too icky to use for this, sorry. send me one if # you come up with it. - compadd - $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) { + _description expl option + compadd "$expl[@]" - $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) { $n = $1; $n =~ s/\)//g; print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; @@ -35,9 +36,11 @@ elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then fi # painless, or what? - _path_files -W mhpath -/ + _description expl 'MH folder' + _path_files "$expl[@]" -W mhpath -/ elif [[ "$prev" = -(editor|(whatnow|rmm|show|more)proc) ]]; then - compgen -c + _description expl command + compgen "$expl[@]" -c elif [[ "$prev" = -file ]]; then _files elif [[ "$prev" = -(form|audit|filter) ]]; then @@ -48,11 +51,14 @@ elif [[ "$prev" = -(form|audit|filter) ]]; then [[ -d $mhlib ]] || { mhlib=$(mhparam mhlproc); mhlib=$mhlib:h; } mhfpath=($mymhdir $mhlib) - compgen -W mhfpath -g '*(.)' + _description expl 'MH template file' + compgen "$expl[@]" -W mhfpath -g '*(.)' elif [[ "$prev" = -(no|)cc ]]; then - compadd all to cc me + _description expl 'CC address' + compadd "$expl[@]" all to cc me elif [[ "$prev" = -[rw]cache ]]; then - compadd public private never ask + _description expl cache + compadd "$expl[@]" public private never ask else # Generate sequences. local foldnam folddir f ret @@ -69,10 +75,11 @@ else # leaving foldnam empty works here fi - compadd $(mark $foldnam 2>/dev/null | awk -F: '{ print $1 }') && + _description expl sequence + compadd "$expl[@]" $(mark $foldnam 2>/dev/null | awk -F: '{ print $1 }') && ret=0 - compadd reply next cur prev first last all unseen && ret=0 - compgen -W folddir -g '<->' && ret=0 + compadd "$expl[@]" reply next cur prev first last all unseen && ret=0 + compgen "$expl[@]" -W folddir -g '<->' && ret=0 return ret fi diff --git a/Completion/User/_pdf b/Completion/User/_pdf index 076b0d111..795e8545b 100644 --- a/Completion/User/_pdf +++ b/Completion/User/_pdf @@ -1,8 +1,11 @@ #compdef acroread pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext xpdf +local expl + # ghostscript: # pdf2dsc pdf2ps # xpdf: # pdfimages pdfinfo pdftopbm pdftops pdftotext xpdf -_files -g '*.(#i)pdf' +_description expl 'PDF file' +_files "$expl[@]" -g '*.(#i)pdf' diff --git a/Completion/User/_ps b/Completion/User/_ps index b91ba8a68..086443586 100644 --- a/Completion/User/_ps +++ b/Completion/User/_ps @@ -1,5 +1,7 @@ #compdef ps2epsi ps2pdf epsffit extractres fixdlsrps fixfmps fixmacps fixpsditps fixpspps fixscribeps fixtpps fixwfwps fixwpps fixwwps includeres psbook psmerge psnup psresize psselect pstops psmulti pswrap lpr lp +local expl + # ghostscript: # ps2epsi ps2pdf # psutils: @@ -7,4 +9,5 @@ # fixscribeps fixtpps fixwfwps fixwpps fixwwps includeres psbook psmerge # psnup psresize psselect pstops -_files -g '*.(#i)(ps|eps)' +_description expl 'postscript file' +_files "$expl[@]" -g '*.(#i)(ps|eps)' diff --git a/Completion/User/_pspdf b/Completion/User/_pspdf index 014d81ce3..ecc4cf82b 100644 --- a/Completion/User/_pspdf +++ b/Completion/User/_pspdf @@ -1,6 +1,11 @@ #compdef gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii ghostview gv gview mgv ggv pstoedit pstotgif +local ret=1 + # ghostscript: # gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii -_files -g '*.(#i)(ps|eps|pdf)' +_ps && ret=0 +_pdf && ret=0 + +return ret diff --git a/Completion/User/_rcs b/Completion/User/_rcs index af66739cb..272e54681 100644 --- a/Completion/User/_rcs +++ b/Completion/User/_rcs @@ -5,8 +5,9 @@ local nm=$compstate[nmatches] [[ $words[1] = ci || $words[1] = rcs ]] && _files if [[ $compstate[nmatches] -eq nm && -d RCS && $words[1] != ci ]]; then - local rep + local rep expl rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//)) - (( $#rep )) && compadd - $rep + _description expl 'RCS file' + (( $#rep )) && compadd "$expl[@]" - $rep fi diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin index 03af65382..8756ec42d 100644 --- a/Completion/User/_rlogin +++ b/Completion/User/_rlogin @@ -1,15 +1,19 @@ #compdef rlogin rsh ssh +local expl + +_description expl user + if [[ CURRENT -eq 2 ]]; if compset -P 1 '*@'; then _hosts else local nm=${compstate[nmatches]} _hosts - [[ nm -eq compstate[nmatches] ]] && compgen -S @ -u + [[ nm -eq compstate[nmatches] ]] && compgen "$expl[@]" -S @ -u fi elif [[ CURRENT -eq 3 ]]; then compadd - -l else - compgen -S @ -u + compgen "$expl[@]" -S @ -u fi diff --git a/Completion/User/_strip b/Completion/User/_strip index d9f44cc5e..529176fdd 100644 --- a/Completion/User/_strip +++ b/Completion/User/_strip @@ -1,3 +1,6 @@ #compdef strip -_files -g '*(*)' +local expl + +_description expl executable +_files "$expl[@]" -g '*(*)' diff --git a/Completion/User/_stty b/Completion/User/_stty index 6e2afcde8..45408fbc1 100644 --- a/Completion/User/_stty +++ b/Completion/User/_stty @@ -1,12 +1,16 @@ #compdef stty +local expl + if [[ "$words[CURRENT-1]" = \ (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]] then - compadd '^-' '^h' '^?' '^c' '^u' + _description expl 'control character' + compadd "$expl[@]" '^-' '^h' '^?' '^c' '^u' else + _description expl setting compset -P '[-+]' - compadd rows columns intr quit erase kill eof eol \ + compadd "$expl[@]" rows columns intr quit erase kill eof eol \ eol2 start stop susp dsusp reprint discard werase lnext \ parenb parodd cs8 cstopb hupcl cread clocal parext \ ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl iuclc \ diff --git a/Completion/User/_su b/Completion/User/_su index e5bf09d80..7b9744cd9 100644 --- a/Completion/User/_su +++ b/Completion/User/_su @@ -1,12 +1,13 @@ #compdef su -local shell comp name usr base +local shell comp name usr base expl [[ $words[2] != - ]] (( base=$?+2 )) if [[ CURRENT -eq base ]]; then - compgen -u && return + _description expl user + compgen "$expl[@]" -u && return usr=root elif [[ CURRENT -ge base+1 ]]; then usr=$words[base] @@ -14,9 +15,9 @@ else return fi -shell=${"$(egrep "^$usr:" </etc/passwd)"##*:} +shell="${${(M@)${(@f)$(</etc/passwd)}:#root*}##*:}" compset -n $base for name in $shell $shell:t -default-; do comp="$_comps[$name]" - [[ ! -z "$comp" ]] && "$comp" && return + [[ -n "$comp" ]] && "$comp" && return done diff --git a/Completion/User/_tar b/Completion/User/_tar index 5fcce5c67..02551759a 100644 --- a/Completion/User/_tar +++ b/Completion/User/_tar @@ -72,11 +72,11 @@ if [[ "$PREFIX" = --* ]]; then # ...long options after `--'. - _long_options '--owner*' "_tilde" \ - '*=(PROG|COMMAND)*' "_command_names" \ - '*=ARCHIVE*' "_tar_archive" \ - '*=NAME*' "_files" \ - '*=CONTROL*' "[t numbered nil existing never simple]" + _long_options '--owner*:user:_tilde' \ + '*=(PROG|COMMAND)*:program:_command_names' \ + '*=ARCHIVE*:archive: _tar_archive' \ + '*=NAME*:file:_files' \ + '*=CONTROL*:version control:[t numbered nil existing never simple]' elif [[ ( CURRENT -gt 2 && "$words[CURRENT-1]" = -*f* && "$words[CURRENT-1]" != --* ) || @@ -93,7 +93,7 @@ elif [[ ( "$_tar_cmd" = *[xt]* || -n $del ) && -n "$tf" ]]; then # filenames cached, plus the name of the tarfile so we know if it # changes. - local largs=-tf + local largs=-tf expl if [[ $_tar_cmd = *z* ]]; then largs=-tzf @@ -110,7 +110,8 @@ elif [[ ( "$_tar_cmd" = *[xt]* || -n $del ) && -n "$tf" ]]; then _tar_cache_name=$tf fi - _multi_parts / _tar_cache_list + _description expl 'file from archive' + _multi_parts "$expl[@]" / _tar_cache_list else # See if we should use a path prefix. We have to use eval as the dir can diff --git a/Completion/User/_tar_archive b/Completion/User/_tar_archive index 58e436c4d..9ddf434f5 100644 --- a/Completion/User/_tar_archive +++ b/Completion/User/_tar_archive @@ -7,14 +7,18 @@ # If your version of `tar' supports this you may want to complete # things like `host:file' or `user@host:file' here. +local expl + [[ $# -eq 0 && $+_tar_cmd -ne 0 ]] && set "$_tar_cmd" +_description expl 'archive file' + if [[ "$1" = *[tx]* ]]; then if [[ "$1" = *[zZ]* ]]; then - _files -g '*.((tar|TAR).(gz|GZ|Z)|.tgz)' + _files "$expl[@]" -g '*.((tar|TAR).(gz|GZ|Z)|.tgz)' else - _files -g '*.(tar|TAR)' + _files "$expl[@]" -g '*.(tar|TAR)' fi else - _files + _files "$expl[@]" fi diff --git a/Completion/User/_tex b/Completion/User/_tex index ac926cfbe..d270c785a 100644 --- a/Completion/User/_tex +++ b/Completion/User/_tex @@ -1,3 +1,6 @@ #compdef tex latex slitex -_files -g '*.(tex|TEX|texinfo|texi)' +local expl + +_description expl 'TeX or LaTeX file' +_files "$expl[@]" -g '*.(tex|TEX|texinfo|texi)' diff --git a/Completion/User/_uncompress b/Completion/User/_uncompress index 0aa1e073f..5392d8fe9 100644 --- a/Completion/User/_uncompress +++ b/Completion/User/_uncompress @@ -1,3 +1,6 @@ #compdef uncompress zmore +local expl + +_description expl 'compressed file' _files -g '*.Z' diff --git a/Completion/User/_use_lo b/Completion/User/_use_lo index e469154ea..a22a5fdb2 100644 --- a/Completion/User/_use_lo +++ b/Completion/User/_use_lo @@ -3,8 +3,4 @@ # This is for GNU-like commands which understand the --help option, # but which do not otherwise require special completion handling. -if [[ $PREFIX = --* ]]; then - _long_options -else - _default -fi +_long_options -t || _default diff --git a/Completion/User/_x_options b/Completion/User/_x_options index 9c3a303bb..4e6b6ba80 100644 --- a/Completion/User/_x_options +++ b/Completion/User/_x_options @@ -1,10 +1,13 @@ #compdef -p */X11/* +local expl + # A simple pattern completion, just as an example. if [ "$words[CURRENT-1]" = "-display" ]; then _compskip=all _hosts -S ':0 ' -r : else - compadd -J options - -display -name -xrm + _description expl option + compadd "$expl[@]" - -display -name -xrm fi diff --git a/Completion/User/_xfig b/Completion/User/_xfig index a3b30bb81..f1c2ca6f5 100644 --- a/Completion/User/_xfig +++ b/Completion/User/_xfig @@ -1,3 +1,6 @@ #compdef xfig -_files -g '*.fig' +local expl + +_description expl 'xfig file' +_files "$expl[@]" -g '*.fig' diff --git a/Completion/User/_xsetroot b/Completion/User/_xsetroot index 74a0b6180..adce06d08 100644 --- a/Completion/User/_xsetroot +++ b/Completion/User/_xsetroot @@ -1,15 +1,22 @@ #compdef xsetroot +local expl + case "$words[CURRENT-1]" in --cursor) _files -/g '*.(#i)(xbm|curs(|or))'; return;; -cursor_name) _cursors; return;; --bitmap) _files -/g '*.(#i)xbm'; return;; -([fb]g|solid)) _colors; return;; +-cursor) _description expl 'cursor file' + _files "$expl[@]" -/g '*.(#i)(xbm|curs(|or))'; return;; +-bitmap) _description expl 'bitmap file' + _files "$expl[@]" -/g '*.(#i)xbm'; return;; esac if [[ CURRENT -gt 2 && "$words[CURRENT-2]" = -cursor ]]; then - _files -/g '*.(#i)(xbm|curs(|or)|mask)' + _description expl 'cursor mask file' + _files "$expl[@]" -/g '*.(#i)(xbm|curs(|or)|mask)' else - compadd -M 'm:-=_ r:|_=*' - -help -def -cursor -cursor_name -bitmap -mod -gray -grey \ - -fg -bg -rv -solid -name + _description expl option + compadd "$expl[@]" -M 'm:-=_ r:|_=*' - \ + -help -def -cursor -cursor_name -bitmap -mod -gray -grey \ + -fg -bg -rv -solid -name fi |