Skip to content

Commit

Permalink
fix broken k8s prompt pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
Okeanos committed Nov 28, 2021
1 parent f38763f commit 3140e97
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions stow/shell/dot-bash_prompt
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ prompt_git() {
}

prompt_k8s() {
if ! command -v "kubectl" &> /dev/null; then
if ! command -v "kubectl" &> /dev/null || ! kubectl config current-context &> /dev/null; then
return
else
local cluster, namespace, format;
local cluster
local namespace;
cluster="$(kubectl config current-context)";
namespace="$(kubens --current 2>/dev/null)"
namespace="$(kubectl config view --minify --output 'jsonpath={..namespace}'; echo)";
format="${bold}";
case "$(echo -n "${cluster}" | cut -d '-' -f2)" in
"dev")
Expand Down

0 comments on commit 3140e97

Please sign in to comment.