mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-26 18:01:03 +02:00
20069: complete character encodings case-insensitively for GNU iconv
This commit is contained in:
parent
c8de227be6
commit
5177458d40
2 changed files with 28 additions and 25 deletions
|
@ -1,5 +1,8 @@
|
|||
2004-06-17 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 20069: Completion/Unix/Command/_iconv: complete character
|
||||
encodings case-insensitively for GNU iconv
|
||||
|
||||
* 20059: Completion/Unix/Command/_chown: check for systems
|
||||
using . separator instead of for those using :
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#compdef iconv
|
||||
|
||||
local expl curcontext="$curcontext" state line codeset LOCPATH ret=1
|
||||
local expl curcontext="$curcontext" state line codeset ret=1
|
||||
local LOCPATH="${LOCPATH:-/usr/lib/nls/loc}"
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
|
||||
|
@ -22,8 +23,9 @@ if _pick_variant gnu=GNU unix --version; then
|
|||
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
|
||||
_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
|
||||
|
||||
|
@ -38,7 +40,7 @@ else
|
|||
if [[ $state = codeset ]]; then
|
||||
if [[ -f /usr/lib/iconv/iconv_data ]]; then # IRIX & Solaris
|
||||
codeset=( ${${(f)"$(</usr/lib/iconv/iconv_data)"}%%[[:blank:]]*} )
|
||||
elif [[ -d ${LOCPATH:=/usr/lib/nls/loc}/iconv ]]; then # OSF
|
||||
elif [[ -d $LOCPATH/iconv ]]; then # OSF
|
||||
codeset=( $LOCPATH/iconv/*(N:t) )
|
||||
codeset=( ${(j:_:s:_:)codeset} )
|
||||
else
|
||||
|
@ -49,5 +51,3 @@ else
|
|||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue