From c218a4a94584f57feaf9a521325c66b75824f0cb Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 17 Apr 2023 17:46:42 +0200 Subject: [PATCH] Feature: Truncate kubectl context using variables Requires the following variables to be defined. Example variable definition: set -x tide_kubectl_truncation_strategy l set -x tide_kubectl_truncation_length 31 Same approach as in: https://github.com/IlanCosman/tide/blob/447945d2cff8f70d5c791dd4eec8b322d37798dd/functions/_tide_item_git.fish#L2 --- functions/_tide_item_kubectl.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/_tide_item_kubectl.fish b/functions/_tide_item_kubectl.fish index ab044b3..95bc93a 100644 --- a/functions/_tide_item_kubectl.fish +++ b/functions/_tide_item_kubectl.fish @@ -1,4 +1,4 @@ function _tide_item_kubectl - kubectl config view --minify --output 'jsonpath={.current-context}/{..namespace}' 2>/dev/null | read -l context && + kubectl config view --minify --output 'jsonpath={.current-context}/{..namespace}' 2>/dev/null | string shorten -"$tide_kubectl_truncation_strategy"m"$tide_kubectl_truncation_length" | read -l context && _tide_print_item kubectl $tide_kubectl_icon' ' (string replace -r '/(|default)$' '' $context) end