Skip to content
This repository was archived by the owner on Apr 24, 2020. It is now read-only.

Commit 086da51

Browse files
committed
feat: #1252 - Disable segment on flag
Add generic mechanism to disable segment when flag $P9K_segment_name_DISABLED is set to "1"
1 parent 04c5cf9 commit 086da51

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

generator/default.p9k

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ function __p9k_build_left_prompt() {
310310

311311
# Remove joined information in direct calls
312312
element="${element%_joined}"
313-
313+
disabled_flag="P9K_$element:u_DISABLED"
314+
if [[ "${(P)disabled_flag}" == "1" ]]; then
315+
continue;
316+
fi
314317
# Check if it is a custom command, otherwise interpet it as
315318
# a prompt.
316319
if [[ $element[0,7] =~ "custom_" ]]; then
@@ -342,7 +345,10 @@ function __p9k_build_right_prompt() {
342345

343346
# Remove joined information in direct calls
344347
element="${element%_joined}"
345-
348+
disabled_flag="P9K_$element:u_DISABLED"
349+
if [[ "${(P)disabled_flag}" == "1" ]]; then
350+
continue;
351+
fi
346352
# Check if it is a custom command, otherwise interpet it as a prompt.
347353
if [[ $element[0,7] =~ "custom_" ]]; then
348354
"__p9k_prompt_custom" "right" "$index" ${joined} $element[8,-1]

0 commit comments

Comments
 (0)