Remove kubectl and add datetime to PS1
This commit is contained in:
parent
5f42d6a5d4
commit
845bd624ed
26
.bashrc
26
.bashrc
@ -155,32 +155,8 @@ git_prompt () {
|
||||
echo " -- $git_branch"
|
||||
}
|
||||
|
||||
kubectl_context() {
|
||||
if [ ! $(which kubectl) ]; then
|
||||
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}")
|
||||
|
||||
prod_color=`tput setaf 1; tput bold`
|
||||
dev_color=`tput setaf 4; tput bold`
|
||||
|
||||
if [[ "$EKS_CLUSTER_NAME" = "tgrosinger-he-extrahop-com" ]]; then
|
||||
echo "-- ${dev_color}${cluster}:${namespace}${c_reset}"
|
||||
else
|
||||
echo "-- ${prod_color}${cluster}:${namespace}${c_reset}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$BASH" != "" ]; then
|
||||
# Prompt
|
||||
PS1="\n╔ \w\$(prev_status_prompt)\$(git_prompt) \$(kubectl_context)\n╚ \h\$ "
|
||||
PS1="\n╔ \w\$(prev_status_prompt)\$(git_prompt) -- \$(date '+%y-%m-%dT%H:%m:%S')\n╚ \h\$ "
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user