change status segment option set

pull/22/head
AdrienHorgnies 7 years ago
parent c69d45cdcc
commit a4f1ce990b

@ -1087,9 +1087,13 @@ prompt_ssh() {
fi fi
} }
# Status: return code if verbose, otherwise just an icon if an error occurred # old options, retro compatibility
set_default POWERLEVEL9K_STATUS_VERBOSE true set_default POWERLEVEL9K_STATUS_VERBOSE true
set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false
# Status: When an error occur, return the error code, or a cross icon if option is set
# Display an ok icon when no error occur, or hide the segment if option is set to false
set_default POWERLEVEL9K_STATUS_CROSS false
set_default POWERLEVEL9K_STATUS_OK true
set_default POWERLEVEL9K_STATUS_SHOW_PIPESTATUS true set_default POWERLEVEL9K_STATUS_SHOW_PIPESTATUS true
prompt_status() { prompt_status() {
local ec_text local ec_text
@ -1112,12 +1116,12 @@ prompt_status() {
fi fi
if (( ec_sum > 0 )); then if (( ec_sum > 0 )); then
if [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then if [[ "$POWERLEVEL9K_STATUS_CROSS" == false && "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then
"$1_prompt_segment" "$0_ERROR" "$2" "red" "226" "$ec_text" 'CARRIAGE_RETURN_ICON' "$1_prompt_segment" "$0_ERROR" "$2" "red" "226" "$ec_text" 'CARRIAGE_RETURN_ICON'
else else
"$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON' "$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON'
fi fi
elif [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true || "$POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE" == true ]]; then elif [[ "$POWERLEVEL9K_STATUS_OK" == true ]] && [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true || "$POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE" == true ]]; then
"$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "green" "" 'OK_ICON' "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "green" "" 'OK_ICON'
fi fi
} }

Loading…
Cancel
Save