diff --git a/cli/.config/fish/conf.d/prompt.fish b/cli/.config/fish/conf.d/prompt.fish index a9c7d0c..50a5b5d 100644 --- a/cli/.config/fish/conf.d/prompt.fish +++ b/cli/.config/fish/conf.d/prompt.fish @@ -1,5 +1,7 @@ set bang_symbol \u276f -set git_sign \ue0a0 +set kube_symbol \u2388 +set kube_config "$HOME/.kube/config" +set git_symbol \ue0a0 set color_git_branch brblack # git symbols and colors diff --git a/cli/.config/fish/functions/fish_prompt.fish b/cli/.config/fish/functions/fish_prompt.fish index 29d81cd..f375667 100644 --- a/cli/.config/fish/functions/fish_prompt.fish +++ b/cli/.config/fish/functions/fish_prompt.fish @@ -4,6 +4,7 @@ function fish_prompt fish_prompt.add \[ brblack fish_prompt.user fish_prompt.add (prompt_pwd) blue + fish_prompt.kube fish_prompt.git fish_prompt.add \] brblack fish_prompt.bang diff --git a/cli/.config/fish/functions/fish_prompt.git.fish b/cli/.config/fish/functions/fish_prompt.git.fish index 01e96f4..257c79b 100644 --- a/cli/.config/fish/functions/fish_prompt.git.fish +++ b/cli/.config/fish/functions/fish_prompt.git.fish @@ -6,7 +6,7 @@ function fish_prompt.git set git_branch (string match -r '[^# .]+' "$line") string match -qr '\[behind' $line && set git_branch "$git_branch?" string match -qr '\[ahead' $line && set git_branch "$git_branch!" - fish_prompt.add "$git_sign $git_branch" + fish_prompt.add "$git_symbol $git_branch" else string match -qr "^.[MD]" "$line" && set git_count[1] (math $git_count[1] + 1) string match -qr "^[MDARC]." "$line" && set git_count[2] (math $git_count[2] + 1) diff --git a/cli/.config/fish/functions/fish_prompt.kube.fish b/cli/.config/fish/functions/fish_prompt.kube.fish new file mode 100644 index 0000000..7b0d152 --- /dev/null +++ b/cli/.config/fish/functions/fish_prompt.kube.fish @@ -0,0 +1,8 @@ +function fish_prompt.kube + if ! test -r "$kube_config" + return + end + fish_prompt.add "$kube_symbol" + set -l kube_context (awk -F- '($1 == "current") {print $3}' "$kube_config") + fish_prompt.add "$kube_context" green +end