From 086da510b7cb8fc2435a5013988ccaab34a80fc9 Mon Sep 17 00:00:00 2001 From: grzesuav Date: Tue, 5 Nov 2019 20:56:28 +0100 Subject: [PATCH] feat: #1252 - Disable segment on flag Add generic mechanism to disable segment when flag $P9K_segment_name_DISABLED is set to "1" --- generator/default.p9k | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/generator/default.p9k b/generator/default.p9k index a0cab4e39..33ce261e4 100644 --- a/generator/default.p9k +++ b/generator/default.p9k @@ -310,7 +310,10 @@ function __p9k_build_left_prompt() { # Remove joined information in direct calls element="${element%_joined}" - + disabled_flag="P9K_$element:u_DISABLED" + if [[ "${(P)disabled_flag}" == "1" ]]; then + continue; + fi # Check if it is a custom command, otherwise interpet it as # a prompt. if [[ $element[0,7] =~ "custom_" ]]; then @@ -342,7 +345,10 @@ function __p9k_build_right_prompt() { # Remove joined information in direct calls element="${element%_joined}" - + disabled_flag="P9K_$element:u_DISABLED" + if [[ "${(P)disabled_flag}" == "1" ]]; then + continue; + fi # Check if it is a custom command, otherwise interpet it as a prompt. if [[ $element[0,7] =~ "custom_" ]]; then "__p9k_prompt_custom" "right" "$index" ${joined} $element[8,-1]