Skip to content

Commit 2ee1e1a

Browse files
albertywtimgraham
authored andcommitted
Fixed #30283 -- Fixed shellcheck warnings in django_bash_completion.
1 parent 1ca825e commit 2ee1e1a

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ answer newbie questions, and generally made Django that much better:
3131
Akshesh Doshi <[email protected]>
3232
3333
Alasdair Nicol <https://al.sdair.co.uk/>
34-
Albert Wang <aywang31@gmail.com>
34+
Albert Wang <https://github.com/albertyw/>
3535
Alcides Fonseca
3636
Aleksandra Sendecka <[email protected]>
3737
Aleksi Häkli <[email protected]>

extras/django_bash_completion

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ _python_django_completion()
4343
{
4444
if [[ ${COMP_CWORD} -ge 2 ]]; then
4545
local PYTHON_EXE=${COMP_WORDS[0]##*/}
46-
echo $PYTHON_EXE | egrep "python([3-9]\.[0-9])?" >/dev/null 2>&1
47-
if [[ $? == 0 ]]; then
46+
if echo "$PYTHON_EXE" | grep -qE "python([3-9]\.[0-9])?"; then
4847
local PYTHON_SCRIPT=${COMP_WORDS[1]##*/}
49-
echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1
50-
if [[ $? == 0 ]]; then
51-
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \
52-
COMP_CWORD=$(( COMP_CWORD-1 )) \
48+
if echo "$PYTHON_SCRIPT" | grep -qE "manage\.py|django-admin(\.py)?"; then
49+
COMPREPLY=( $( COMP_WORDS=( "${COMP_WORDS[*]:1}" )
50+
COMP_CWORD=$(( COMP_CWORD-1 ))
5351
DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) )
5452
fi
5553
fi
@@ -64,7 +62,7 @@ if command -v whereis &>/dev/null; then
6462
[[ $python != *-config ]] && pythons="${pythons} ${python##*/}"
6563
done
6664
unset python_interpreters
67-
pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
65+
pythons=$(echo "$pythons" | tr " " "\n" | sort -u | tr "\n" " ")
6866
else
6967
pythons=python
7068
fi

0 commit comments

Comments
 (0)