I'm trying to setup a bash completion, and have two problems
- For parameter one, I needed a completion for directories
- For parameter two, a fixed array for completion, I just don't know how to let bash make a selection, before I always used a perl script for complex ones.
_some_func()
{
case $COMP_CWORD in
1)
# default completion ? how
;;
2)
COMPREPLY=( "go" "unbind" )
# I should be using a program to echo "go" and "unbind",
# and let bash decide which one to complete , right ?
# that's the only two possible parameters here
;;
esac
}
complete -F _some_func some_func