1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Fixed #25221 -- Prevented django_bash_completion from leaking variables into the environment.

This commit is contained in:
Ville Skyttä 2015-08-04 17:07:06 +03:00 committed by Tim Graham
parent 6d7a9d96fe
commit 74be214e81

View File

@ -42,10 +42,10 @@ complete -F _django_completion -o default django-admin.py manage.py django-admin
_python_django_completion() _python_django_completion()
{ {
if [[ ${COMP_CWORD} -ge 2 ]]; then if [[ ${COMP_CWORD} -ge 2 ]]; then
PYTHON_EXE=${COMP_WORDS[0]##*/} local PYTHON_EXE=${COMP_WORDS[0]##*/}
echo $PYTHON_EXE | egrep "python([2-9]\.[0-9])?" >/dev/null 2>&1 echo $PYTHON_EXE | egrep "python([2-9]\.[0-9])?" >/dev/null 2>&1
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
PYTHON_SCRIPT=${COMP_WORDS[1]##*/} local PYTHON_SCRIPT=${COMP_WORDS[1]##*/}
echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1 echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \ COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \
@ -63,9 +63,11 @@ if command -v whereis &>/dev/null; then
for python in $python_interpreters; do for python in $python_interpreters; do
pythons="${pythons} ${python##*/}" pythons="${pythons} ${python##*/}"
done done
unset python_interpreters
pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ") pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
else else
pythons=python pythons=python
fi fi
complete -F _python_django_completion -o default $pythons complete -F _python_django_completion -o default $pythons
unset pythons