Ticket #1240: app_completion.diff

File app_completion.diff, 889 bytes (added by Rob Hudson <treborhudson@…>, 18 years ago)

Adding app completion to existing bash script using standard unix tools (sed, grep, tr).

  • extras/django_bash_completion

     
    7979            adminindex|install|reset| \
    8080            sql|sqlall|sqlclear|sqlindexes| \
    8181            sqlinitialdata|sqlreset|sqlsequencereset)
    82             # App completion isn't yet implemented, but here's where that
    83             # would go.
    84             # COMPREPLY=( $(compgen -W "auth core" -- ${cur}) )
    85             COMPREPLY=()
     82            # App completion
     83            apps=`sed -n '/INSTALLED_APPS = (/,/)/p' settings.py | \
     84                  grep -v django |
     85                  sed -n "s/^[ ]*'.*\.\(.*\)'.*$/\1 /pg" | \
     86                  tr -d '\n'`
     87            COMPREPLY=( $(compgen -W "${apps}" -- ${cur}) )
    8688            return 0
    8789            ;;
    8890
Back to Top