summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_django
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-10-14 23:03:40 +0200
committerOliver Kiddle <opk@zsh.org>2014-10-14 23:04:45 +0200
commit13fc579343b24d298fb8905933b6000d7fcda114 (patch)
treecbc1000696357438714107635f93166bcab76d3a /Completion/Unix/Command/_django
parent66320ca93a717467a0ed0d34da4c06257953aa50 (diff)
downloadzsh-13fc579343b24d298fb8905933b6000d7fcda114.tar.gz
zsh-13fc579343b24d298fb8905933b6000d7fcda114.zip
33467: correct return status on functions and numerous other minor fixes
Diffstat (limited to 'Completion/Unix/Command/_django')
-rw-r--r--Completion/Unix/Command/_django25
1 files changed, 11 insertions, 14 deletions
diff --git a/Completion/Unix/Command/_django b/Completion/Unix/Command/_django
index ac20409eb..029687696 100644
--- a/Completion/Unix/Command/_django
+++ b/Completion/Unix/Command/_django
@@ -1,26 +1,23 @@
#compdef django-admin.py django-admin manage.py
-local ret=1 state
+local curcontext="$curcontext" state line expl ret=1
-if [ "$service" = "manage.py" ] && [ ! -x ./manage.py ]; then
- return 0
+if [[ "$service" = "manage.py" && ! -x ./manage.py ]]; then
+ _default
+ return
fi
declare -ga common_args
common_args=(
'--help[display help information]'
'--version[display version information]'
- '--pythonpath=[directory to add to the Python path]:directory:_directories'
- '--settings=[Python path to settings module]:settings'
+ '--pythonpath=[directory to add to the Python path]:directory:_directories -W / -P /'
+ '--settings=[python path to settings module]:settings'
'--traceback[print traceback on exception]'
)
-_directories () {
- _wanted directories expl directory _path_files -/ "$@" -
-}
-
typeset -A opt_args
-_arguments \
+_arguments -C \
$common_args \
':subcommand:->subcommand' \
'*::options:->options' && ret=0
@@ -66,7 +63,7 @@ case $state in
subcommands+=($cmd)
fi
done
-
+
_describe -t subcommands 'django admin subcommand' subcommands && ret=0
;;
@@ -101,8 +98,8 @@ case $state in
settings="${DJANGO_SETTINGS_MODULE}"
else
return 0
- fi
-
+ fi
+
_wanted appname expl appname compadd - $(command \
sed -n "/INSTALLED_APPS\s*=\s*(/,/)/p" ${settings} | \
sed -n "s/^\s*'\(.*\.\)*\(.*\)'.*$/\2 /pg")
@@ -205,7 +202,7 @@ case $state in
;;
esac
- _arguments $args && ret=0
+ _arguments -C $args && ret=0
;;
esac