From a6da6880baadd0af8d91198a401f0f32828ba5d4 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 13 Mar 2023 10:50:09 +0100 Subject: [PATCH] Better aliases --- zsh/aliases.zsh | 5 +++++ zsh/ohmyzsh/themes/laptop-hostname.zsh-theme | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 93b0b6a..2106bfc 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -112,6 +112,10 @@ fi command -v kubectl > /dev/null 2>&1 if [ $? -eq 0 ]; then + if [ -f $HOME/.kubes/current-cube ]; then + export KUBECONFIG=$(cat $HOME/.kubes/current-cube) + fi + # Sets the kube config kube() { local kube_config=$HOME/.kubes/$1/config @@ -122,6 +126,7 @@ if [ $? -eq 0 ]; then echo >&2 error: no such kube config: $kube_config return 1 else + echo $kube_config > ~/.kubes/current-cube export KUBECONFIG=$kube_config fi } diff --git a/zsh/ohmyzsh/themes/laptop-hostname.zsh-theme b/zsh/ohmyzsh/themes/laptop-hostname.zsh-theme index d5a1740..1ada924 100644 --- a/zsh/ohmyzsh/themes/laptop-hostname.zsh-theme +++ b/zsh/ohmyzsh/themes/laptop-hostname.zsh-theme @@ -76,8 +76,15 @@ else fi fi +git_prompt_info_no_space() { + local info=$(git_prompt_info) + if [ ! -z $info ]; then + echo " $info" + fi +} + local return_code="" -local git_branch=' $(git_prompt_info)' +local git_branch='$(git_prompt_info_no_space)' local PR_DATE='${PR_BOLD}${PR_MAGENTA}[%D{%H:%M}]${PR_NO_COLOR}'