refreshed dotfiles
This commit is contained in:
@@ -7,7 +7,6 @@ alias kubi="open -a 'Lens'"
|
||||
|
||||
|
||||
# ALIAS COMMANDS
|
||||
alias ssh="enhanced_ssh"
|
||||
alias ld="ls -lisaGh"
|
||||
alias g="goto"
|
||||
alias grep='grep --color'
|
||||
@@ -18,3 +17,4 @@ alias do-re="docker compose down && docker compose up -d"
|
||||
alias hetzi="ssh root@128.140.71.88"
|
||||
alias kc1='export KUBECONFIG=~/.kube/config'
|
||||
alias kc2='export KUBECONFIG=~/.kube/mobilistics'
|
||||
alias ram='vm_stat'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
#Theme
|
||||
ZSH_THEME="bira"
|
||||
# ZSH_THEME="bira"
|
||||
|
||||
#plugins
|
||||
plugins=(git kubectl docker npm pip sudo macos zsh-autosuggestions command-not-found zsh-syntax-highlighting 1password)
|
||||
|
||||
@@ -43,5 +43,44 @@ case $_distro in
|
||||
*) ICON="";;
|
||||
esac
|
||||
|
||||
# Kubernetes integration
|
||||
function update_kubernetes_context() {
|
||||
if command -v kubectl &> /dev/null; then
|
||||
KUBE_CTX=$(kubectl config current-context 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
KUBE_NS=$(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
|
||||
export STARSHIP_KUBERNETES_CONTEXT="$KUBE_CTX"
|
||||
[ -n "$KUBE_NS" ] && export STARSHIP_KUBERNETES_NAMESPACE="$KUBE_NS"
|
||||
else
|
||||
unset STARSHIP_KUBERNETES_CONTEXT
|
||||
unset STARSHIP_KUBERNETES_NAMESPACE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Update kubernetes context on startup
|
||||
update_kubernetes_context
|
||||
|
||||
# Function to wrap kubectl and update context when needed
|
||||
function kubectl() {
|
||||
command kubectl "$@"
|
||||
local exit_code=$?
|
||||
|
||||
# Update context if the command was successful and changed the context or namespace
|
||||
if [ $exit_code -eq 0 ] && [[ "$1" == "config" && ("$2" == "use-context" || "$2" == "set-context") ]]; then
|
||||
update_kubernetes_context
|
||||
fi
|
||||
return $exit_code
|
||||
}
|
||||
|
||||
# Kubernetes aliases
|
||||
alias k='kubectl'
|
||||
alias kgp='kubectl get pods'
|
||||
alias kgn='kubectl get nodes'
|
||||
alias kgs='kubectl get services'
|
||||
alias kgc='kubectl config get-contexts'
|
||||
alias kuc='kubectl config use-context'
|
||||
alias kns='kubectl config set-context --current --namespace'
|
||||
|
||||
export STARSHIP_DISTRO="$ICON"
|
||||
export STARSHIP_DEVICE="$DEVICE"
|
||||
export STARSHIP_DEVICE="$DEVICE"
|
||||
|
||||
Reference in New Issue
Block a user