mirror of
https://github.com/Crocmagnon/dotfiles.git
synced 2024-11-04 22:04:00 +01:00
Allow passing pod to kdjango
This commit is contained in:
parent
aa53b661cb
commit
3ef5c7fd3c
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
# Defined interactively
|
||||
function kdjango --description 'Pop into the shell of django pod of the current namespace'
|
||||
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
|
||||
argparse -X 1 -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)"
|
||||
|
@ -23,7 +23,11 @@ function kdjango --description 'Pop into the shell of django pod of the current
|
|||
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)
|
||||
if count $argv > /dev/null
|
||||
set pod $argv[1]
|
||||
else
|
||||
set pod (kubectl get pods -o name | grep "django" | grep -Ev "celery|migrations" | head -1)
|
||||
end
|
||||
echo "running $command in $pod"
|
||||
kubectl exec -it $pod -- $command
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue