Multi Level Bash Completion

Thanks to mkb’s comment, I looked into the p4 example, which was—unlike the Git example—simple enough for me to adapt to my case. Here is the working version which does exactly what I asked for: have pbt && _pbt_complete() { local cur prev COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $(compgen … Read more

How to reset COMP_WORDBREAKS without affecting other completion script?

Modifying $COMP_WORDBREAKS in your completion script is not the recommended way (as it is a global variable and it could affect the behavior of other completion scripts – for example ssh). However, bash completion offers some helper methods which you can use to achieve your goal. The recommended way to handle non-word-breaking characters in completion … Read more