[bash] Fix my k8s aliases again (alas: backport them from fish)

This commit is contained in:
Sebastian Schulze 2023-10-15 21:07:59 +02:00
parent bdb530a563
commit 4c54a7cf17
No known key found for this signature in database
GPG Key ID: F6BA63C6A7D3044E
1 changed files with 5 additions and 5 deletions

View File

@ -52,22 +52,22 @@ function take {
# return the basename of the current folder or an argument
# Used to supply the kubernetes pods with the correct app name
function k_app {
if set -q argv; then
echo $argv
if [[ $# -ne 0 ]]; then
echo "${*}"
else
echo $(basename $(pwd))
fi
}
function kfp {
kpods $argv | head -n 1
kpods ${*} | head -n 1
}
function kpods {
if set -q argv; then
if [[ $# -eq 0 ]]; then
kubectl get pod --no-headers=true -o custom-columns=:metadata.name
else
kubectl get pod -l app=$(k_app $argv) --no-headers=true -o custom-columns=:metadata.name
kubectl get pod -l app=$(k_app "${*}") --no-headers=true -o custom-columns=:metadata.name
fi
}