Notice that this one is migrated and the other isn't. I think a lot of users still don't realize that they shouldn't be posting a question on multiple SE sites. They're used to disparate forums that aren't a unified system, where you might ask in a few different forums for a better chance of a fast answer.
–
jcrawfordorMay 27 '11 at 18:43

Whenever you type cooltool f[TAB][TAB], the _cooltool() function is invoked. It will work out what your current partial word is and then compgen will work out which options match. These are stored in an array called COMPREPLY which is then displayed. Look at man complete and man compgen for details.