2010-08-22 11:16:33 +02:00
|
|
|
# iconv(1) completion
|
|
|
|
|
2011-04-05 00:35:51 +03:00
|
|
|
have iconv || return
|
|
|
|
|
2010-08-22 11:16:33 +02:00
|
|
|
_iconv()
|
|
|
|
{
|
2011-05-01 22:18:40 +03:00
|
|
|
local cur prev words cword split
|
|
|
|
_init_completion -s || return
|
2010-08-22 11:16:33 +02:00
|
|
|
|
|
|
|
case $prev in
|
|
|
|
-'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\
|
|
|
|
--widechar-subst)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-f|--from-code|-t|--to-code)
|
|
|
|
COMPREPLY=( $( compgen -W '$( iconv -l | \
|
|
|
|
sed -e "s@/*\$@@" -e "s/[,()]//g" )' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-o|--output)
|
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
$split && return 0
|
|
|
|
|
|
|
|
if [[ "$cur" = -* ]]; then
|
2011-04-28 21:21:31 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
2011-05-02 11:41:52 +03:00
|
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
2010-08-22 11:16:33 +02:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
} &&
|
|
|
|
complete -F _iconv -o default iconv
|
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
|
|
|
# sh-basic-offset: 4
|
|
|
|
# sh-indent-comment: t
|
|
|
|
# indent-tabs-mode: nil
|
|
|
|
# End:
|
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|