feat(prompt): mostra namespace k8s, stato job running/stopped e nuovi glyph
This commit is contained in:
@@ -120,16 +120,21 @@ function fish_prompt --description 'Write out the prompt'
|
|||||||
echo -n (prompt_pwd)
|
echo -n (prompt_pwd)
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|
||||||
# Git + Kubernetes cluster
|
# Git
|
||||||
set -l vcs (fish_vcs_prompt)
|
set -l vcs (fish_vcs_prompt)
|
||||||
if test -n "$vcs"
|
if test -n "$vcs"
|
||||||
printf '%s' $vcs
|
printf '%s' $vcs
|
||||||
# Kubernetes context
|
# Kubernetes context + namespace
|
||||||
if command -sq kubectl
|
if command -sq kubectl
|
||||||
set -l kctx (kubectl config current-context 2>/dev/null)
|
set -l kctx (kubectl config current-context 2>/dev/null)
|
||||||
|
set -l kns (kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
|
||||||
if test -n "$kctx"
|
if test -n "$kctx"
|
||||||
set_color brblack
|
set_color brblack
|
||||||
echo -n " [$kctx]"
|
echo -n " ☸$kctx"
|
||||||
|
if test -n "$kns" -a "$kns" != default
|
||||||
|
set_color bryellow
|
||||||
|
echo -n ":$kns"
|
||||||
|
end
|
||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -142,14 +147,28 @@ function fish_prompt --description 'Write out the prompt'
|
|||||||
echo -n $prompt_status
|
echo -n $prompt_status
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|
||||||
# Background jobs counter
|
# Background jobs: [N|M] running in green, stopped in yellow
|
||||||
set -l jobs_count (count (jobs -p))
|
set -l n_running (count (jobs | string match -r '\trunning\t'))
|
||||||
if test $jobs_count -gt 0
|
set -l n_stopped (count (jobs | string match -r '\tstopped\t'))
|
||||||
|
if test $n_running -gt 0 -o $n_stopped -gt 0
|
||||||
set_color yellow
|
set_color yellow
|
||||||
echo -n "[$jobs_count] "
|
echo -n '['
|
||||||
|
set_color normal
|
||||||
|
set_color green
|
||||||
|
echo -n $n_running
|
||||||
|
set_color normal
|
||||||
|
set_color yellow
|
||||||
|
echo -n '|'
|
||||||
|
set_color normal
|
||||||
|
set_color yellow
|
||||||
|
echo -n $n_stopped
|
||||||
|
set_color normal
|
||||||
|
set_color yellow
|
||||||
|
echo -n '] '
|
||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|
||||||
# Prompt on new line
|
# Prompt on new line
|
||||||
echo
|
echo '>-< <~> >>=>>=>> '
|
||||||
|
echo '<-> '
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user