2010年2月19日

Custom Tab Completion

Custom Tab Completion
Programmable Completion
# unicode(1) completion
# put this file in /etc/bash_completion.d/unicode

have unicode &&
_unicode()
{
local cur

COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}

if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -x --hexadecimal \
-d --decimal -r --regexp -s --string -a --auto \
-m --max= -i --io= -c --charset-add= \
-C --colour= -v --verbose -w --wikipedia' -- $cur ) )
fi

}
[ "${have:-}" ] && complete -F _unicode $filenames unicode

$ unicode -<tab><tab>

沒有留言:

網誌存檔