From 4c54a7cf178bfa75f66f8e06b9ea1e2e44997969 Mon Sep 17 00:00:00 2001 From: Sebastian Schulze Date: Sun, 15 Oct 2023 21:07:59 +0200 Subject: [PATCH] [bash] Fix my k8s aliases again (alas: backport them from fish) --- dot_config/bash/aliases.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dot_config/bash/aliases.sh b/dot_config/bash/aliases.sh index 3ef4b78..ea16a92 100644 --- a/dot_config/bash/aliases.sh +++ b/dot_config/bash/aliases.sh @@ -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 }