mirror of
https://github.com/Crocmagnon/dotfiles.git
synced 2024-11-22 06:28:08 +01:00
Update kdjango
This commit is contained in:
parent
758cc61488
commit
80fde827a1
1 changed files with 10 additions and 6 deletions
|
@ -11,6 +11,11 @@ function kdjango --description 'Pop into the shell of django pod of the current
|
|||
echo -e "\nRequires kubens for namespace selection"
|
||||
return
|
||||
end
|
||||
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
|
||||
set -l command /bin/bash
|
||||
if set -q _flag_b
|
||||
set command /bin/bash
|
||||
|
@ -21,12 +26,11 @@ function kdjango --description 'Pop into the shell of django pod of the current
|
|||
else if set -q _flag_o
|
||||
set command ./manage.py shell
|
||||
else if set -q _flag_d
|
||||
if kubectl exec -it $pod -- which pgcli &> /dev/null
|
||||
set command 'pgcli $(./manage.py sqldsn --quiet --style=uri)'
|
||||
else
|
||||
set command ./manage.py dbshell
|
||||
end
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue