I am only scratching my own itch here, but maybe someone can use it or expand from it.
I just always found annoying that pear run-tests tab gives all files instead of just *.phpt. This is what this snippet actually does.
Paste this into the file /opt/local/etc/bash_completion on OSX (for me it is just before _filedir_xspec()) or into a new file /etc/bash_completion.d/pear on Debian.
# pear completion
have pear &&
local cur prev commands options command
commands='build bundle channel-add channel-alias channel-delete channel-discover channel-info channel-update clear-cache config-create config-get config-help config-set config-show convert cvsdiff cvstag download download-all info install list list-all list-channels list-files list-upgrades login logout makerpm package package-dependencies package-validate pickle remote-info remote-list run-scripts run-tests search shell-test sign uninstall update-channels upgrade upgrade-all'
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-V' -- $cur ) )
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
case $command in
complete -F _pear $default pear
Then re-source your bashrc or logout and re-login.
I am far from being an expert in bash_completion programming, so I hope someone can go on from here (or maybe has something more complete lying around?).