From 01e67ec323e5466204970a637f81e4d4427da396 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 12 Mar 2003 18:55:12 +0000 Subject: fix completions of locales on Linux, complete for more commands using existing completions and more improvements to sccs completion --- Completion/Unix/Command/_cdcd | 2 +- Completion/Unix/Command/_iconv | 33 ++++++---- Completion/Unix/Command/_java | 136 +++++++++++++++++++++++++++-------------- Completion/Unix/Command/_sccs | 44 ++++++++++--- Completion/Unix/Type/_locales | 3 +- Completion/Unix/Type/_pids | 6 +- Completion/Unix/Type/_users | 2 +- 7 files changed, 153 insertions(+), 73 deletions(-) (limited to 'Completion') diff --git a/Completion/Unix/Command/_cdcd b/Completion/Unix/Command/_cdcd index ad385bc3b..9e832eea5 100644 --- a/Completion/Unix/Command/_cdcd +++ b/Completion/Unix/Command/_cdcd @@ -40,7 +40,7 @@ _cdcd_commands () 'access:configure cddb access method' 'help:display a help message' ) - _describe 'cdcd command' commands + _describe -t commands 'cdcd command' commands } if (( CURRENT == 2 )); then diff --git a/Completion/Unix/Command/_iconv b/Completion/Unix/Command/_iconv index 490d70bc8..8e12e2107 100644 --- a/Completion/Unix/Command/_iconv +++ b/Completion/Unix/Command/_iconv @@ -1,24 +1,33 @@ #compdef iconv -local expl curcontext="$curcontext" state line codeset LOCPATH +local expl curcontext="$curcontext" state line codeset LOCPATH ret=1 if _pick_variant gnu=GNU unix --version; 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 + local exargs="--list -? --help --usage --version -V" + _arguments -C -S -s \ + "(-f --from-code $exargs)"{-f+,--from-code=}'[specify code set of input file]:code set:->codeset' \ + "(-t --to-code $exargs)"{-t+,--to-code=}'[specify code set for output]:code set:->codeset' \ + '(- 1)--list[list all character code sets]' \ + "($exargs)-c[omit invalid characters from output]" \ + "(-o --output $exargs)"{-o+,--output=}'[specify output file]:output file:_files' \ + "(-s --silent --verbose $exargs)"{-s,--silent}'[suppress warnings]' \ + "(-s --silent $exargs)--verbose[print progress information]" \ + '(-)'{-\?,--help}'[display help information]' \ + '(-)--usage[display a short usage message]' \ + '(-)'{-V,--version}'[print program version]' \ + '1:input file:_files' && return 0 if [[ $state = codeset ]]; then - _wanted codesets expl 'code set' \ - compadd "$@" ${${(s:,:)$(iconv --list|sed -n '/^$/,$ p')}## #} + if compset -P '*/'; then + _wanted option expl option compadd "$@" /TRANSLIT && ret=0 + else + _wanted codesets expl 'code set' compadd "$@" -M 'r:|-=* r:|=*' \ + ${${${(f)"$(iconv --list|sed -n '/^$/,$ p')"}## #}%//} && ret=0 + fi fi + return ret else _arguments -C \ diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index ff5ded202..992960f59 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -382,40 +382,26 @@ extdirs) encoding) tmp=( - '8859_1:ISO 8859-1' - '8859_2:ISO 8859-2' - '8859_3:ISO 8859-3' - '8859_4:ISO 8859-4' - '8859_5:ISO 8859-5' - '8859_6:ISO 8859-6' - '8859_7:ISO 8859-7' - '8859_8:ISO 8859-8' - '8859_9:ISO 8859-9' - 'Big5:Big5, Traditional Chinese' - 'CNS11643:CNS 11643, Traditional Chinese' - 'Cp037:USA, Canada(Bilingual, French), Netherlands, Portugal, Brazil, Australia' - 'Cp1006:IBM AIX Pakistan (Urdu)' - 'Cp1025:IBM Multilingual Cyrillic - Bulgaria, Bosnia, Herzegovinia, Macedonia(FYR)' - 'Cp1026:IBM Latin-5, Turkey' - 'Cp1046:IBM Open Edition US EBCDIC' - 'Cp1097:IBM Iran(Farsi)/Persian' - 'Cp1098:IBM Iran(Farsi)/Persian (PC)' - 'Cp1112:IBM Latvia, Lithuania' - 'Cp1122:IBM Estonia' - 'Cp1123:IBM Ukraine' - 'Cp1124:IBM AIX Ukraine' - 'Cp1125:IBM Ukraine (PC)' - 'Cp1250:Windows Eastern European' - 'Cp1251:Windows Cyrillic' + 'US-ASCII:American Standard Code for Information Interchange' 'Cp1252:Windows Latin-1' - 'Cp1253:Windows Greek' - 'Cp1254:Windows Turkish' - 'Cp1255:Windows Hebrew' - 'Cp1256:Windows Arabic' - 'Cp1257:Windows Baltic' - 'Cp1258:Windows Vietnamese' - 'Cp1381:IBM OS/2, DOS Peopl'\''es Republic of China (PRC)' - 'Cp1383:IBM AIX People'\''s Republic of China (PRC)' + 'ISO-8859-1:ISO 8859-1, Latin alphabet No. 1 ' + 'ISO-8859-15:Latin alphabet No. 9 ' + 'UTF-8:Eight-bit UCS Transformation Format' + 'UTF-16:Sixteen-bit UCS Transformation Format, byte order identified by an' + 'UTF-16BE:Sixteen-bit UCS Transformation Format, big-endian byte order ' + 'UTF-16LE:Sixteen-bit UCS Transformation Format, little-endian byte order ' + 'ASCII:American Standard Code for Information Interchange' + 'ISO8859_1:ISO 8859-1, Latin alphabet No. 1' + 'UnicodeBig:Sixteen-bit Unicode Transformation Format, big-endian' + 'UnicodeBigUnmarked:Sixteen-bit Unicode Transformation Format, big-endian' + 'UnicodeLittle:Sixteen-bit Unicode Transformation Format, little-endian' + 'UnicodeLittleUnmarked:Sixteen-bit Unicode Transformation Format, little-endian' + 'UTF8:Eight-bit Unicode Transformation Format' + 'UTF-16:Sixteen-bit Unicode Transformation Format, byte order' + 'Big5:Big5, Traditional Chinese' + 'Big5_HKSCS:Big5 with Hong Kong extensions, Traditional Chinese' + 'Big5_Solaris:Big5 with seven additional Hanzi ideograph character mappings ' + 'Cp037:USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia' 'Cp273:IBM Austria, Germany' 'Cp277:IBM Denmark, Norway' 'Cp278:IBM Finland, Sweden' @@ -423,7 +409,6 @@ encoding) 'Cp284:IBM Catalan/Spain, Spanish Latin America' 'Cp285:IBM United Kingdom, Ireland' 'Cp297:IBM France' - 'Cp33722:IBM-eucJP - Japanese (superset of 5050)' 'Cp420:IBM Arabic' 'Cp424:IBM Hebrew' 'Cp437:MS-DOS United States, Australia, New Zealand, South Africa' @@ -434,7 +419,9 @@ encoding) 'Cp850:MS-DOS Latin-1' 'Cp852:MS-DOS Latin-2' 'Cp855:IBM Cyrillic' + 'Cp856:IBM Hebrew' 'Cp857:IBM Turkish' + 'Cp858:Variant of Cp850 with Euro character' 'Cp860:MS-DOS Portuguese' 'Cp861:MS-DOS Icelandic' 'Cp862:PC Hebrew' @@ -448,32 +435,89 @@ encoding) 'Cp871:IBM Iceland' 'Cp874:IBM Thai' 'Cp875:IBM Greek' - 'Cp918:IBM Pakistan(Urdu)' + 'Cp918:IBM Pakistan (Urdu)' 'Cp921:IBM Latvia, Lithuania (AIX, DOS)' 'Cp922:IBM Estonia (AIX, DOS)' 'Cp930:Japanese Katakana-Kanji mixed with 4370 UDC, superset of 5026' 'Cp933:Korean Mixed with 1880 UDC, superset of 5029' 'Cp935:Simplified Chinese Host mixed with 1880 UDC, superset of 5031' - 'Cp937:Traditional Chinese Host miexed with 6204 UDC, superset of 5033' + 'Cp937:Traditional Chinese Host miexed with 6204 UDC, superset 5033' 'Cp939:Japanese Latin Kanji mixed with 4370 UDC, superset of 5035' - 'Cp942:Japanese (OS/2) superset of 932' + 'Cp942:IBM OS/2 Japanese, superset of Cp932' + 'Cp942C:Variant of Cp942' + 'Cp943:IBM OS/2 Japanese, superset of Cp932 and Shift-JIS' + 'Cp943C:Variant of Cp943' 'Cp948:OS/2 Chinese (Taiwan) superset of 938' 'Cp949:PC Korean' + 'Cp949C:Variant of Cp949' 'Cp950:PC Chinese (Hong Kong, Taiwan)' 'Cp964:AIX Chinese (Taiwan)' 'Cp970:AIX Korean' - 'EUCJIS:JIS, EUC Encoding, Japanese' - 'GB2312:GB2312, EUC encoding, Simplified Chinese' + 'Cp1006:IBM AIX Pakistan (Urdu)' + 'Cp1025:IBM Multilingual Cyrillic (Bulgaria, Bosnia)' + 'Cp1025:IBM Multilingual Cyrillic - Bulgaria, Bosnia, Herzegovinia, Macedonia (FYR)' + 'Cp1026:IBM Latin-5, Turkey' + 'Cp1046:IBM Arabic - Windows' + 'Cp1097:IBM Iran (Farsi)/Persian' + 'Cp1098:IBM Iran (Farsi)/Persian (PC)' + 'Cp1112:IBM Latvia, Lithuania' + 'Cp1122:IBM Estonia' + 'Cp1123:IBM Ukraine' + 'Cp1124:IBM AIX Ukraine' + 'Cp1140:Variant of Cp037 with Euro character' + 'Cp1141:Variant of Cp273 with Euro character' + 'Cp1142:Variant of Cp277 with Euro character' + 'Cp1143:Variant of Cp278 with Euro character' + 'Cp1144:Variant of Cp280 with Euro character' + 'Cp1145:Variant of Cp284 with Euro character' + 'Cp1146:Variant of Cp285 with Euro character' + 'Cp1147:Variant of Cp297 with Euro character' + 'Cp1148:Variant of Cp500 with Euro character' + 'Cp1149:Variant of Cp871 with Euro character' + 'Cp1250:Windows Eastern European' + 'Cp1251:Windows Cyrillic' + 'Cp1253:Windows Greek' + 'Cp1254:Windows Turkish' + 'Cp1255:Windows Hebrew' + 'Cp1256:Windows Arabic' + 'Cp1257:Windows Baltic' + 'Cp1258:Windows Vietnamese' + "Cp1381:IBM OS/2, DOS People's Republic of China (PRC)" + "Cp1383:IBM AIX People's Republic of China (PRC)" + 'Cp33722:IBM-eucJP - Japanese (superset of 5050)' + 'EUC_CN:GB2312, EUC encoding, Simplified Chinese' + 'EUC_JP:JIS X 0201, 0208, 0212, EUC encoding, Japanese' + 'EUC_KR:KS C 5601, EUC encoding, Korean' + 'EUC_TW:CNS11643 (Plane 1-3), EUC encoding, Traditional Chinese' + 'GB18030:Simplified Chinese, PRC standard' 'GBK:GBK, Simplified Chinese' - 'ISO2022CN:ISO 2022 CN, Chinese' - 'ISO2022CN_CNS:CNS 11643 in ISO-2022-CN form, T. Chinese' - 'ISO2022CN_GB:GB 2312 in ISO-2022-CN form, S. Chinese' + 'ISCII91:ISCII91 encoding of Indic scripts' + 'ISO2022CN:ISO 2022 CN, Chinese (conversion to Unicode only)' + 'ISO2022CN_CNS:CNS 11643 in ISO 2022 CN form, Traditional Chinese' + 'ISO2022CN_GB:GB 2312 in ISO 2022 CN form, Simplified Chinese' + 'ISO2022JP:JIS X 0201, 0208 in ISO 2022 form, Japanese' 'ISO2022KR:ISO 2022 KR, Korean' - 'JIS:JIS, Japanese' - 'JIS0208:JIS 0208, Japanese' + 'ISO8859_2:ISO 8859-2, Latin alphabet No. 2' + 'ISO8859_3:ISO 8859-3, Latin alphabet No. 3' + 'ISO8859_4:ISO 8859-4, Latin alphabet No. 4' + 'ISO8859_5:ISO 8859-5, Latin/Cyrillic alphabet' + 'ISO8859_6:ISO 8859-6, Latin/Arabic alphabet' + 'ISO8859_7:ISO 8859-7, Latin/Greek alphabet' + 'ISO8859_8:ISO 8859-8, Latin/Hebrew alphabet' + 'ISO8859_9:ISO 8859-9, Latin alphabet No. 5' + 'ISO8859_13:ISO 8859-13, Latin alphabet No. 7' + 'ISO8859_15:ISO 8859-15, Latin alphabet No. 9' + 'JIS0201:JIS X 0201, Japanese' + 'JIS0208:JIS X 0208, Japanese' + 'JIS0212:JIS X 0212, Japanese' + 'JISAutoDetect:Detects and converts from Shift-JIS, EUC-JP, ISO 2022 JP' + 'Johab:Johab, Korean' 'KOI8_R:KOI8-R, Russian' - 'KSC5601:KS C 5601, Korean' 'MS874:Windows Thai' + 'MS932:Windows Japanese' + 'MS936:Windows Simplified Chinese' + 'MS949:Windows Korean' + 'MS950:Windows Traditional Chinese' 'MacArabic:Macintosh Arabic' 'MacCentralEurope:Macintosh Latin-2' 'MacCroatian:Macintosh Croatian' @@ -489,7 +533,7 @@ encoding) 'MacTurkish:Macintosh Turkish' 'MacUkraine:Macintosh Ukraine' 'SJIS:Shift-JIS, Japanese' - 'UTF8:UTF-8' + 'TIS620:TIS620, Thai' ) _describe 'character encoding' tmp -- ;; diff --git a/Completion/Unix/Command/_sccs b/Completion/Unix/Command/_sccs index ed0dd516d..2591ceb16 100644 --- a/Completion/Unix/Command/_sccs +++ b/Completion/Unix/Command/_sccs @@ -6,7 +6,7 @@ _sccs_files() { dir="${(M)PREFIX##*/}$finalpath" [[ $~dir = (.|..|)/* ]] || dir="${PROJECTDIR:-~+}/$dir" compset -P "*/" - _wanted file expl file compadd "$@" - $~dir/*(N.:t:s/s.//) && ret=0 + _wanted file expl file compadd "$@" - $~dir/s.*(N.:t:s/s.//) && ret=0 PREFIX="$pref" IPREFIX="$ipref" _wanted sccs-files expl 'sccs file' _files -W ${PROJECTDIR:-~+} \ @@ -20,9 +20,31 @@ typeset -A opt_args local subcmds ropt copt sfiles finalpath subcmds=( - admin cdc check clean comb create deledit delget delta diffs edit - enter fix get help info print prs ptr rmdel sact sccsdiff tell - unedit unget val what + 'admin:modify the flags or checksum of an sccs history file' + 'cdc:annotate the commentary of an sccs delta' + 'check:check for files currently being edited' + 'clean:remove files that can be retrieved from sccs history' + 'comb:generate scripts to combine deltas' + 'create:create (initialize) history files' + 'deledit:check file in and straight out again' + 'delget:check file in and maintain read-only copy' + 'delta:check in changes' + 'diffs:compare working copy with version in sccs history' + 'edit:retrieve file for editing (check out)' + "enter:like create, but omits the final 'sccs get'" + 'fix:revise a (leaf) delta' + 'get:retieve a version from the sccs history' + 'help:get information on sccs commands and error messages' + {info,tell}':list files being edited' + 'print:print history of specified files' + 'prs:display delta table for an sccs file' + 'prt:display the delta table, but omit the MR field' + 'rmdel:remove specfied delta from history file' + 'sact:show editing activity status of an sccs file' + 'sccsdiff:compare two versions from sccs history' + {unedit,unget}':undo check out' + 'val:validate history file' + 'what:display any ID keyword strings in a file' ) ropt='-r+[specify sccs delta id]:sccs delta id' @@ -37,7 +59,7 @@ if [[ $service = sccs ]]; then '*::command:->subcmd' && return 0 if (( CURRENT == 1 )); then - _wanted commands expl 'sccs command' compadd -a subcmds + _describe -t commands 'sccs command' subcmds return fi service="$words[1]" @@ -102,9 +124,10 @@ case $service in ;; fix) _arguments "$ropt" "$sfiles";; help) - _alternative \ - "commands:sccs command:(${(j: :)subcmds})" \ - 'message-codes:sccs message code:' + [[ $PREFIX$SUFFIX = [0-9]# ]] && + _message -e message-codes "sccs message code" + subcmds+=( "stuck:help on help" ) + _describe -t commands 'sccs command' subcmds ;; prs) _arguments "$sfiles" "$ropt" "$copt" \ @@ -128,6 +151,11 @@ case $service in ;; rmdel) _arguments "$ropt" "$sfiles";; sccsdiff) _diff_options diff "$ropt" "$sfiles";; + unedit|unget) + _arguments "$sfiles" "$ropt" \ + '-s[silent]' \ + '-n[retain the retrieved version]' + ;; val) _arguments "$sfiles" "$ropt" \ '-s[silent]' \ diff --git a/Completion/Unix/Type/_locales b/Completion/Unix/Type/_locales index ad5741c8a..d8d1ed451 100644 --- a/Completion/Unix/Type/_locales +++ b/Completion/Unix/Type/_locales @@ -1,9 +1,10 @@ -#compdef -value-,LANG,-default- -P -value-,LC_*,-default- +#compdef -value-,LANG,-default- -value-,LANGUAGE,-default- -P -value-,LC_*,-default- local locales if (( $+commands[locale] )); then locales=( $(_call_program locales locale -a) ) + [[ $OSTYPE = linux-gnu ]] && locales=( ${locales/utf8/UTF-8} ) else locales=( /usr/lib/locale/*(:t) ) fi diff --git a/Completion/Unix/Type/_pids b/Completion/Unix/Type/_pids index 7b09a1195..e20844703 100644 --- a/Completion/Unix/Type/_pids +++ b/Completion/Unix/Type/_pids @@ -1,9 +1,9 @@ -#autoload +#compdef pflags pcred pmap pldd psig pstack pfiles pwdx pstop prun pwait ptree # If given the `-m ' option, this tries to complete only pids # of processes whose command line match the `'. -local out pids list expl match desc listargs args all nm ret=1 +local out pids list expl match desc listargs all nm ret=1 _tags processes || return 1 @@ -20,8 +20,6 @@ else nm="$compstate[nmatches]" fi -zstyle -s ":completion:${curcontext}:processes" command args - out=( "${(@f)$(_call_program processes ps 2>/dev/null)}" ) desc="$out[1]" out=( "${(@M)out[2,-1]:#${~match}}" ) diff --git a/Completion/Unix/Type/_users b/Completion/Unix/Type/_users index d04a16afe..08c22bbc2 100644 --- a/Completion/Unix/Type/_users +++ b/Completion/Unix/Type/_users @@ -1,4 +1,4 @@ -#compdef passwd groups userdel +#compdef passwd groups userdel chage chfn chsh local expl users -- cgit 1.4.1