From 845bd624edff81c8cab43f8d62457a22205ef332 Mon Sep 17 00:00:00 2001 From: Tony Grosinger Date: Wed, 27 Dec 2023 08:09:50 -0800 Subject: [PATCH] Remove kubectl and add datetime to PS1 --- .bashrc | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/.bashrc b/.bashrc index 06d2732..d4ad871 100755 --- a/.bashrc +++ b/.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