Skip to content

Commit

Permalink
feat: toggle-ctx as kubectl plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
himkt committed Apr 6, 2024
1 parent 8b0a805 commit 9ddefa5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 8 additions & 0 deletions bin/kubectl-toggle_ctx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash


if test -f $HOME/.kubectl-hide-current-ctx; then
rm $HOME/.kubectl-hide-current-ctx
else
touch $HOME/.kubectl-hide-current-ctx
fi
10 changes: 1 addition & 9 deletions zsh/config.d/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function current_architecture () {
}

function current_context () {
if [ ! -z "$KUBECTL_HIDE_CURRENT_CONTEXT" ]; then
if test -f ~/.kubectl-hide-current-ctx; then
echo ""
return
fi
Expand All @@ -275,14 +275,6 @@ function current_context () {
fi
}

function toggle-ctx () {
if [ -z "$KUBECTL_HIDE_CURRENT_CONTEXT" ]; then
export KUBECTL_HIDE_CURRENT_CONTEXT=1
else
unset KUBECTL_HIDE_CURRENT_CONTEXT
fi
}

function current_path () {
echo "[%{${fg[yellow]}%}%~%{${reset_color}%}] "
}
Expand Down

0 comments on commit 9ddefa5

Please sign in to comment.