Fixes to make bash prompt cleaner in more environments

This commit is contained in:
Tony Grosinger 2022-09-23 16:12:41 -07:00
parent fe76fcea96
commit 2dbb1fa153

10
.bashrc
View File

@ -26,10 +26,7 @@ if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
# append and reload the history after each command
PROMPT_COMMAND="history -a; history -n"
for filename in ${HOME}/.ssh/*.pub; do
keyname="$(basename ${filename} .pub)"
eval $(keychain --nogui --eval --quiet ${keyname})
done
eval $(find "${HOME}/.ssh/" -type f -name "*.pub" | xargs -n 1 keychain --nogui --eval --quiet)
# bind -x '"\C-r"':reset
fi
@ -137,6 +134,11 @@ kubectl_context() {
return 0
fi
kubectl cluster-info > /dev/null 2>&1
if [ $? -ne 0 ]; then
return 0
fi
context=$(kubectl config current-context 2>/dev/null)
namespace=$(kubectl config view -o "jsonpath={.contexts[?(@.name==\"$context\")].context.namespace}")
cluster=$(kubectl config view -o "jsonpath={.contexts[?(@.name==\"$context\")].context.cluster}")