Update kdjango

This commit is contained in:
Gabriel Augendre 2022-03-23 16:04:35 +01:00
parent 3de8666949
commit 527164fb94

View file

@ -1,12 +1,13 @@
# Defined interactively
function kdjango --description 'Pop into the shell of django pod of the current namespace'
argparse -x "h,b,s,m" "h/help" "b/bash" "s/sh" "m/manage" "o/original-shell" -- $argv; or return
argparse -x "h,b,s,m,o,d" "h/help" "b/bash" "s/sh" "m/manage" "o/original-shell" "d/db-shell" -- $argv; or return
if set -q _flag_h
echo "Exec into the django pod of the current namespace..."
echo -e "kdjango [-b]\t ...using bash (default if no option)"
echo -e "kdjango -s\t ...using sh"
echo -e "kdjango -m\t ...using manage.py shell_plus"
echo -e "kdjango -o\t ...using manage.py shell"
echo -e "kdjango -d\t ...using manage.py dbshell"
echo -e "\nRequires kubens for namespace selection"
return
end
@ -19,6 +20,8 @@ function kdjango --description 'Pop into the shell of django pod of the current
set command ./manage.py shell_plus
else if set -q _flag_o
set command ./manage.py shell
else if set -q _flag_d
set command ./manage.py dbshell
end
set pod (kubectl get pods -o name | grep "django" | grep -Ev "celery|migrations" | head -1)
echo "running $command in $pod"