fish: kube support
This commit is contained in:
parent
afce6858f2
commit
a8e215506a
4 changed files with 13 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
||||||
set bang_symbol \u276f
|
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
|
set color_git_branch brblack
|
||||||
|
|
||||||
# git symbols and colors
|
# git symbols and colors
|
||||||
|
|
|
@ -4,6 +4,7 @@ function fish_prompt
|
||||||
fish_prompt.add \[ brblack
|
fish_prompt.add \[ brblack
|
||||||
fish_prompt.user
|
fish_prompt.user
|
||||||
fish_prompt.add (prompt_pwd) blue
|
fish_prompt.add (prompt_pwd) blue
|
||||||
|
fish_prompt.kube
|
||||||
fish_prompt.git
|
fish_prompt.git
|
||||||
fish_prompt.add \] brblack
|
fish_prompt.add \] brblack
|
||||||
fish_prompt.bang
|
fish_prompt.bang
|
||||||
|
|
|
@ -6,7 +6,7 @@ function fish_prompt.git
|
||||||
set git_branch (string match -r '[^# .]+' "$line")
|
set git_branch (string match -r '[^# .]+' "$line")
|
||||||
string match -qr '\[behind' $line && set git_branch "$git_branch?"
|
string match -qr '\[behind' $line && set git_branch "$git_branch?"
|
||||||
string match -qr '\[ahead' $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
|
else
|
||||||
string match -qr "^.[MD]" "$line" && set git_count[1] (math $git_count[1] + 1)
|
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)
|
string match -qr "^[MDARC]." "$line" && set git_count[2] (math $git_count[2] + 1)
|
||||||
|
|
8
cli/.config/fish/functions/fish_prompt.kube.fish
Normal file
8
cli/.config/fish/functions/fish_prompt.kube.fish
Normal file
|
@ -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
|
Loading…
Reference in a new issue