We've been using python Baker[1] to achieve the similar thing with a little bit of extra flexibility. Occasionally we call out to bash but most scripts are written in python.
The sub-commands are handled simply by having a primary baker that calls the execute method on the children: 'b git' => 'import git; git.execute(['b git'] + argv)'