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

Fixed #30283 -- Fixed shellcheck warnings in django_bash_completion.

This commit is contained in:
Albert Wang 2019-03-23 08:56:44 -07:00 committed by Tim Graham
parent 1ca825e4dc
commit 2ee1e1a174
2 changed files with 6 additions and 8 deletions

View File

@ -31,7 +31,7 @@ answer newbie questions, and generally made Django that much better:
Akshesh Doshi <aksheshdoshi+django@gmail.com> Akshesh Doshi <aksheshdoshi+django@gmail.com>
alang@bright-green.com alang@bright-green.com
Alasdair Nicol <https://al.sdair.co.uk/> Alasdair Nicol <https://al.sdair.co.uk/>
Albert Wang <aywang31@gmail.com> Albert Wang <https://github.com/albertyw/>
Alcides Fonseca Alcides Fonseca
Aleksandra Sendecka <asendecka@hauru.eu> Aleksandra Sendecka <asendecka@hauru.eu>
Aleksi Häkli <aleksi.hakli@iki.fi> Aleksi Häkli <aleksi.hakli@iki.fi>

View File

@ -43,13 +43,11 @@ _python_django_completion()
{ {
if [[ ${COMP_CWORD} -ge 2 ]]; then if [[ ${COMP_CWORD} -ge 2 ]]; then
local PYTHON_EXE=${COMP_WORDS[0]##*/} local PYTHON_EXE=${COMP_WORDS[0]##*/}
echo $PYTHON_EXE | egrep "python([3-9]\.[0-9])?" >/dev/null 2>&1 if echo "$PYTHON_EXE" | grep -qE "python([3-9]\.[0-9])?"; then
if [[ $? == 0 ]]; then
local PYTHON_SCRIPT=${COMP_WORDS[1]##*/} local PYTHON_SCRIPT=${COMP_WORDS[1]##*/}
echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1 if echo "$PYTHON_SCRIPT" | grep -qE "manage\.py|django-admin(\.py)?"; then
if [[ $? == 0 ]]; then COMPREPLY=( $( COMP_WORDS=( "${COMP_WORDS[*]:1}" )
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \ COMP_CWORD=$(( COMP_CWORD-1 ))
COMP_CWORD=$(( COMP_CWORD-1 )) \
DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) ) DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) )
fi fi
fi fi
@ -64,7 +62,7 @@ if command -v whereis &>/dev/null; then
[[ $python != *-config ]] && pythons="${pythons} ${python##*/}" [[ $python != *-config ]] && pythons="${pythons} ${python##*/}"
done done
unset python_interpreters 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