From 49c58da9f502f75822d9dff660953c8e14985142 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Fri, 10 Jan 2020 17:57:57 +0100 Subject: [PATCH] k8s support --- zsh/k8s.zsh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 zsh/k8s.zsh diff --git a/zsh/k8s.zsh b/zsh/k8s.zsh new file mode 100644 index 0000000..1d4feae --- /dev/null +++ b/zsh/k8s.zsh @@ -0,0 +1,19 @@ +slimline::section::k8s_context::precmd() { + unset slimline_section_k8s_context_output +} + +slimline::section::k8s_context::async_task() { + kubectl config current-context + # gsed -nr '/current-context/s/(.*) (.*)/\2/p' ~/.kube/config +} + +slimline::section::k8s_context::async_task_complete() { + slimline_section_k8s_context_output=$2 +} + +slimline::section::k8s_context::render() { + [[ -z "${slimline_section_k8s_context_output}" ]] && return + + slimline::utils::expand "k8s_context" "[k8s:%F{blue}|output|%f]" \ + "output" "${slimline_section_k8s_context_output}" \ +}