Skip to content
Snippets Groups Projects
Unverified Commit c127fc21 authored by Jon Mosco's avatar Jon Mosco Committed by GitHub
Browse files

Merge pull request #19 from alexymantha/add-format-function

Add context and namespace formatting function 
parents 07b993d9 52f6e6a8
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,9 @@ KUBE_TMUX_KUBECONFIG_CACHE="${KUBECONFIG}"
KUBE_TMUX_UNAME=$(uname)
KUBE_TMUX_LAST_TIME=0
KUBE_TMUX_CLUSTER_FUNCTION="${KUBE_TMUX_CLUSTER_FUNCTION}"
KUBE_TMUX_NAMESPACE_FUNCTION="${KUBE_TMUX_NAMESPACE_FUNCTION}"
_kube_tmux_binary_check() {
command -v $1 >/dev/null
}
......@@ -125,6 +128,16 @@ _kube_tmux_get_context_ns() {
# Set namespace to 'default' if it is not defined
KUBE_TMUX_NAMESPACE="${KUBE_TMUX_NAMESPACE:-default}"
fi
_kube_tmux_format_context_ns
}
_kube_tmux_format_context_ns() {
if [[ -n "${KUBE_TMUX_CLUSTER_FUNCTION}" ]]; then
KUBE_TMUX_CONTEXT=$($KUBE_TMUX_CLUSTER_FUNCTION $KUBE_TMUX_CONTEXT)
fi
if [[ -n "${KUBE_TMUX_NAMESPACE_FUNCTION}" ]]; then
KUBE_TMUX_CONTEXT=$($KUBE_TMUX_NAMESPACE_FUNCTION $KUBE_TMUX_NAMESPACE)
fi
}
kube_tmux() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment