Travis Cline (aka tclineks) posted in a comment to the article “Faster baking of controllers with the bake shell script” a link to a bash completion script he started to write for CakePHP’s console.

As I didn’t understood what his script did nor how to use it, Travis explained it in the following way:

It [the bash completion script] gives you bash completion (through hitting tab) for shells and for the bake it gives you bake actions and will autocomplete potential model/view/controller names.

Here’s an intro to bash_completion: http://www.debian-administration.org/articles/316

So,
after I source this (`. bashcompletion`, `source bashcompletion`, or link it in the right location -> /etc/bash_completion.d/) I can type

`(path to console)/cake [tab][tab]`

and it lists the potential shells to use e.g. acl, api, bake (even app-specific shells)

`/cake b[tab]` -> completes ‘bake’

`/cake bake m[tab]` -> completes ‘model’

If I further do

`/cake bake model M[tab][tab]` it’ll complete for models beginning with ‘M’

It’s pretty crude atm — doesn’t handle -app params (you can invoke the console within the custom app dir for now).

If bake.php/shell is enhanced to support public, noninteractive listing this could be pretty sweet.

The bash completion provided by this script when using the CakePHP console is really handy. Thanks Travis!