From e222689ea14bcf037ef5085d85216c8bd2ddd3d0 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 21 Mar 2005 16:50:17 +0000 Subject: merge changes from 4.3 branch --- Completion/Unix/Command/_iconv | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Completion/Unix/Command/_iconv (limited to 'Completion/Unix/Command/_iconv') diff --git a/Completion/Unix/Command/_iconv b/Completion/Unix/Command/_iconv new file mode 100644 index 000000000..92fa17e34 --- /dev/null +++ b/Completion/Unix/Command/_iconv @@ -0,0 +1,55 @@ +#compdef iconv + +local expl curcontext="$curcontext" state line ret=1 +local LOCPATH="${LOCPATH:-/usr/lib/nls/loc}" +local -U codeset + +if _pick_variant gnu=GNU unix --version; then + + 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 + if compset -P '*/'; then + _wanted option expl option compadd "$@" /TRANSLIT && ret=0 + else + _wanted codesets expl 'code set' compadd "$@" \ + -M 'm:{a-zA-Z}={A-Za-z} r:|-=* r:|=*' \ + ${${${(f)"$(_call_program codesets iconv --list|sed -n '/^$/,$ p')"}## #}%//} && ret=0 + fi + fi + + return ret +else + + _arguments -C \ + '-f[specify code set of input file]:code set:->codeset' \ + '-t[specify code set for output]:code set:->codeset' \ + '1:file:_files' && return 0 + + if [[ $state = codeset ]]; then + if [[ -f /usr/lib/iconv/iconv_data ]]; then # IRIX & Solaris + codeset=( ${${(f)"$(