With a django project, you get a script called
manage.py, which has a bunch of subcommands such as
migrate, etc. You can get a list of them all by running the script with no arguments.
My plan is to parse that output, and use it to power TAB completion after
. manage.py, and also set up aliases, so I can just type
migr[TAB] instead of
My problem is that because it's Python, and it needs to load in all the django machinery to show the subcommands, I'm waiting about a half second every time, on a really small project. The larger the project, the longer it takes.
My idea was to run the interrogation of the script, definition of aliases, and setup of autocompletion, in a background task a la
(for subcommand in parse_manage_py; do alias $subcommand='./manage.py $subcommand'; done) &
But that doesn't set any variables in the parent shell. I mucked around with
export for a while before I figured out that exports "downwards" instead of "upwards".