Add more iconv option completions, use _split_longopt.

This commit is contained in:
Ville Skyttä 2010-04-11 16:40:34 +03:00
parent 6a6cab1179
commit a44c07fb9e
3 changed files with 21 additions and 9 deletions

View File

@ -25,10 +25,10 @@ bash-completion (2.x)
* Apply cardctl completion to pccardctl too.
* Apply pine completion to alpine too.
* Remove many unnecessary short option completions where long ones exist.
* Improve chsh, chgrp, chown, configure, cvs, gkrellm, gzip, lftp, look,
make, man, mdadm, modprobe, mplayer, mysqladmin, perldoc, rsync, screen,
service, scp, ssh, sshfs, update-alternatives, vncviewer, yp-tools, and
general hostname completions.
* Improve chsh, chgrp, chown, configure, cvs, gkrellm, gzip, iconv, lftp,
look, make, man, mdadm, modprobe, mplayer, mysqladmin, perldoc, rsync,
screen, service, scp, ssh, sshfs, update-alternatives, vncviewer, yp-tools,
and general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz.
* Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, pm-utils, rtcwake,
pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz and unpigz completions.

View File

@ -3,24 +3,36 @@
have iconv &&
_iconv()
{
local cur prev
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true
case $prev in
-f|-t|--from-code|--to-code)
-'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\
--widechar-subst)
return 0
;;
-f|--from-code|-t|--to-code)
COMPREPLY=( $( compgen -W \
'$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
return 0
;;
-o|--output)
_filedir
return 0
;;
esac
$split && return 0
if [[ "$cur" = -* ]]; then
COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
--output -o --verbose' -- "$cur" ) )
COMPREPLY=( $( compgen -W '--from-code --to-code --list -c
--unicode-subst --byte-subst --widechar-subst --output --silent
--verbose --help --usage --version' -- "$cur" ) )
return 0
fi
} &&

View File

@ -11,7 +11,7 @@ proc teardown {} {
setup
assert_complete_any "iconv "
assert_complete_any "iconv -"
sync_after_int