Ticket #1240: support_for_multiple_interpreters.diff
File support_for_multiple_interpreters.diff, 1.6 KB (added by , 18 years ago) |
---|
-
django_bash_completion
31 31 # 32 32 # To uninstall, just remove the line from your .bash_profile and .bashrc. 33 33 34 # Enable extended pattern matching operators. 35 shopt -s extglob 36 34 37 _django_completion() 35 38 { 36 39 local cur prev opts actions action_shell_opts action_runfcgi_opts … … 58 61 || 59 62 # python manage.py, /some/path/python manage.py (if manage.py exists) 60 63 ( ${COMP_CWORD} -eq 2 && 61 ( $( basename ${COMP_WORDS[0]} ) == python ) &&64 ( $( basename ${COMP_WORDS[0]} ) == python?([1-9]\.[0-9]) ) && 62 65 ( $( basename ${COMP_WORDS[1]} ) == manage.py) && 66 ( -r ${COMP_WORDS[1]} ) ) 67 || 68 ( ${COMP_CWORD} -eq 2 && 69 ( $( basename ${COMP_WORDS[0]} ) == python?([1-9]\.[0-9]) ) && 70 ( $( basename ${COMP_WORDS[1]} ) == django-admin.py) && 63 71 ( -r ${COMP_WORDS[1]} ) ) ]] ; then 64 72 65 73 case ${cur} in … … 135 143 } 136 144 137 145 complete -F _django_completion django-admin.py manage.py 146 147 # Support for multiple interpreters. 148 unset pythons 149 if command -v whereis &>/dev/null; then 150 python_interpreters=$(whereis -b python | cut -d " " -f 2-) 151 for python in $python_interpreters; do 152 pythons="${pythons} $(basename $python)" 153 done 154 pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ") 155 else 156 pythons=python 157 fi 158 159 complete -F _django_completion -o default $pythons