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

Commit

Permalink
feat: #1252 - Disable segment on flag
Browse files Browse the repository at this point in the history
Add generic mechanism to disable segment when flag
$P9K_segment_name_DISABLED is set to "1"
  • Loading branch information
grzesuav committed Nov 5, 2019
1 parent 04c5cf9 commit 086da51
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions generator/default.p9k
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 086da51

Please sign in to comment.