diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-02-25 20:01:08 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-02-25 20:01:08 +0000 |
| commit | 8a70334640b31229d53e982bd59d951fe15aecbc (patch) | |
| tree | 793c50ad4f6fea8de6507672aa123adade5f3abf /extras | |
| parent | 43829a95d3e5740250794a0b4400fd813e724a2e (diff) | |
newforms-admin: Merged to [4579]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'extras')
| -rw-r--r-- | extras/django_bash_completion | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/extras/django_bash_completion b/extras/django_bash_completion index 829756c371..79efc5b3b1 100644 --- a/extras/django_bash_completion +++ b/extras/django_bash_completion @@ -79,10 +79,28 @@ _django_completion() adminindex|install|reset| \ sql|sqlall|sqlclear|sqlindexes| \ sqlinitialdata|sqlreset|sqlsequencereset) - # App completion isn't yet implemented, but here's where that - # would go. - # COMPREPLY=( $(compgen -W "auth core" -- ${cur}) ) - COMPREPLY=() + # App completion + settings="" + # If settings.py in the PWD, use that + if [ -e settings.py ] ; then + settings="$PWD/settings.py" + else + # Use the ENV variable if it is set + if [ $DJANGO_SETTINGS_MODULE ] ; then + settings=$DJANGO_SETTINGS_MODULE + fi + fi + # Couldn't find settings so return nothing + if [ -z $settings ] ; then + COMPREPLY=() + # Otherwise inspect settings.py file + else + apps=`sed -n "/INSTALLED_APPS = (/,/)/p" $settings | \ + grep -v "django.contrib" | + sed -n "s/^[ ]*'\(.*\.\)*\(.*\)'.*$/\2 /pg" | \ + tr -d "\n"` + COMPREPLY=( $(compgen -W "${apps}" -- ${cur}) ) + fi return 0 ;; |
