$ startp2p.sh [TAB-key]and the shell should return the options:
amule bt
Achieve that is very easy, just create as root the following file:
/etc/bash_completion.d/startp2p.shwith this content:
_startp2p()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="amule bt"
if [[ ${cur} == * && ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _startp2p -o filenames startp2p.sh
/etc/bash_completion.d/startp2p.sh
To test it, reboot the computer or run
. /etc/bash_completion.d/startp2p.sh
For more information about bash completion visit this links:
An introduction to bash completion: part 1
An introduction to bash completion: part 2
Gentoo guide for shell completion
Comments (0)