mychanges

This commit is contained in:
Ghasem Shirazi 2022-12-05 09:51:00 -08:00
commit a50fcdfb02
105 changed files with 27351 additions and 0 deletions

26
plugins/kubectx/README.md Normal file
View file

@ -0,0 +1,26 @@
# kubectx - show active kubectl context
This plugins adds ```kubectx_prompt_info()``` function. It shows name of the
active kubectl context (```kubectl config current-context```).
You can use it to customize prompt and know if You are on prod cluster ;)
_Example_. Add to **.zshrc**:
```
RPS1='$(kubectx_prompt_info)'
```
### custom ctx names
One can rename default context name for better readability.
_Example_. Add to **.zshrc**:
```
kubectx_mapping[minikube]="mini"
kubectx_mapping[context_name_from_kubeconfig]="$emoji[wolf_face]"
kubectx_mapping[production_cluster]="%{$fg[yellow]%}prod!%{$reset_color%}"
```
![staging](stage.png)
![production](prod.png)

View file

@ -0,0 +1,13 @@
typeset -g -A kubectx_mapping
function kubectx_prompt_info() {
(( $+commands[kubectl] )) || return
local current_ctx=$(kubectl config current-context 2> /dev/null)
[[ -n "$current_ctx" ]] || return
# use value in associative array if it exists
# otherwise fall back to the context name
echo "${kubectx_mapping[$current_ctx]:-${current_ctx:gs/%/%%}}"
}

BIN
plugins/kubectx/prod.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
plugins/kubectx/stage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB