@ -570,7 +570,7 @@ prompt_context() {
typeset -AH context_states
typeset -AH context_states
context_states=(
context_states=(
"ROOT" "yellow"
"ROOT" "yellow"
"DEFAULT" "011 "
"DEFAULT" "yellow "
)
)
local content=""
local content=""
@ -613,7 +613,7 @@ prompt_user() {
"STATE" "DEFAULT"
"STATE" "DEFAULT"
"CONTENT" "$(whoami)"
"CONTENT" "$(whoami)"
"BACKGROUND_COLOR" "${DEFAULT_COLOR}"
"BACKGROUND_COLOR" "${DEFAULT_COLOR}"
"FOREGROUND_COLOR" "011 "
"FOREGROUND_COLOR" "yellow "
"VISUAL_IDENTIFIER" "USER_ICON"
"VISUAL_IDENTIFIER" "USER_ICON"
)
)
fi
fi
@ -640,7 +640,7 @@ prompt_host() {
"STATE" "LOCAL"
"STATE" "LOCAL"
"CONTENT" "${POWERLEVEL9K_HOST_TEMPLATE}"
"CONTENT" "${POWERLEVEL9K_HOST_TEMPLATE}"
"BACKGROUND_COLOR" "${DEFAULT_COLOR}"
"BACKGROUND_COLOR" "${DEFAULT_COLOR}"
"FOREGROUND_COLOR" "011 "
"FOREGROUND_COLOR" "yellow "
"VISUAL_IDENTIFIER" "HOST_ICON"
"VISUAL_IDENTIFIER" "HOST_ICON"
)
)
fi
fi
@ -687,7 +687,7 @@ prompt_command_execution_time() {
fi
fi
if (( _P9K_COMMAND_DURATION >= POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )); then
if (( _P9K_COMMAND_DURATION >= POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )); then
"$1_prompt_segment" "$0" "$2" "red" "226 " "${humanReadableDuration}" 'EXECUTION_TIME_ICON'
"$1_prompt_segment" "$0" "$2" "red" "yellow1 " "${humanReadableDuration}" 'EXECUTION_TIME_ICON'
fi
fi
}
}
@ -702,10 +702,10 @@ prompt_dir() {
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
truncate_middle)
truncate_middle)
current_path=$(pwd | sed -e "s,^$HOME,~, " | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g")
current_path=$(echo "$current_path " | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g")
;;
;;
truncate_from_right)
truncate_from_right)
current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,") " )
current_path=$(truncatePathFromRight "$current_path " )
;;
;;
truncate_with_package_name)
truncate_with_package_name)
local name repo_path package_path current_dir zero
local name repo_path package_path current_dir zero
@ -755,8 +755,12 @@ prompt_dir() {
# Instead of printing out the full path, print out the name of the package
# Instead of printing out the full path, print out the name of the package
# from the package.json and append the current subdirectory
# from the package.json and append the current subdirectory
current_path="`echo $packageName | tr -d '"'`$subdirectory_path"
current_path="`echo $packageName | tr -d '"'`$subdirectory_path"
if [[ "${POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER}" == "true" ]]; then
# add space before the packageName to allow for removing the "first" character, without messing up the package name.
current_path=" ${current_path}"
fi
else
else
current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,")" )
current_path=$(truncatePathFromRight "$current_path " )
fi
fi
;;
;;
truncate_with_folder_marker)
truncate_with_folder_marker)
@ -859,13 +863,13 @@ prompt_go_version() {
go_path=$(go env GOPATH 2>/dev/null)
go_path=$(go env GOPATH 2>/dev/null)
if [[ -n "$go_version" && "${PWD##$go_path}" != "$PWD" ]]; then
if [[ -n "$go_version" && "${PWD##$go_path}" != "$PWD" ]]; then
"$1_prompt_segment" "$0" "$2" "green" "255 " "$go_version" "GO_ICON"
"$1_prompt_segment" "$0" "$2" "green" "grey93 " "$go_version" "GO_ICON"
fi
fi
}
}
# Command number (in local history)
# Command number (in local history)
prompt_history() {
prompt_history() {
"$1_prompt_segment" "$0" "$2" "244 " "$DEFAULT_COLOR" '%h'
"$1_prompt_segment" "$0" "$2" "grey50 " "$DEFAULT_COLOR" '%h'
}
}
# Detection for virtualization (systemd based systems only)
# Detection for virtualization (systemd based systems only)
@ -1027,7 +1031,7 @@ prompt_nodeenv() {
# print a little OS icon
# print a little OS icon
prompt_os_icon() {
prompt_os_icon() {
"$1_prompt_segment" "$0" "$2" "black" "255 " "$OS_ICON"
"$1_prompt_segment" "$0" "$2" "black" "white " "$OS_ICON"
}
}
# print PHP version number
# print PHP version number
@ -1036,7 +1040,7 @@ prompt_php_version() {
php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*")
php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*")
if [[ -n "$php_version" ]]; then
if [[ -n "$php_version" ]]; then
"$1_prompt_segment" "$0" "$2" "013" "255 " "$php_version"
"$1_prompt_segment" "$0" "$2" "fuchsia" "grey93 " "$php_version"
fi
fi
}
}
@ -1102,7 +1106,7 @@ prompt_rust_version() {
rust_version=$(rustc --version 2>&1 | grep -oe "^rustc\s*[^ ]*" | grep -o '[0-9.a-z\\\-]*$')
rust_version=$(rustc --version 2>&1 | grep -oe "^rustc\s*[^ ]*" | grep -o '[0-9.a-z\\\-]*$')
if [[ -n "$rust_version" ]]; then
if [[ -n "$rust_version" ]]; then
"$1_prompt_segment" "$0" "$2" "208 " "$DEFAULT_COLOR" "Rust $rust_version" 'RUST_ICON'
"$1_prompt_segment" "$0" "$2" "darkorange " "$DEFAULT_COLOR" "Rust $rust_version" 'RUST_ICON'
fi
fi
}
}
# RSpec test ratio
# RSpec test ratio
@ -1121,7 +1125,7 @@ prompt_rvm() {
local version_and_gemset=${rvm_env_string/ruby-}
local version_and_gemset=${rvm_env_string/ruby-}
if [[ -n "$version_and_gemset" ]]; then
if [[ -n "$version_and_gemset" ]]; then
"$1_prompt_segment" "$0" "$2" "240 " "$DEFAULT_COLOR" "$version_and_gemset" 'RUBY_ICON'
"$1_prompt_segment" "$0" "$2" "grey35 " "$DEFAULT_COLOR" "$version_and_gemset" 'RUBY_ICON'
fi
fi
}
}
@ -1177,7 +1181,7 @@ prompt_status() {
if (( ec_sum > 0 )); then
if (( ec_sum > 0 )); then
if [[ "$POWERLEVEL9K_STATUS_CROSS" == false && "$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" "yellow1 " "$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
@ -1226,7 +1230,7 @@ prompt_symfony2_version() {
if [[ -f app/bootstrap.php.cache ]]; then
if [[ -f app/bootstrap.php.cache ]]; then
local symfony2_version
local symfony2_version
symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g')
symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g')
"$1_prompt_segment" "$0" "$2" "240 " "$DEFAULT_COLOR" "$symfony2_version" 'SYMFONY_ICON'
"$1_prompt_segment" "$0" "$2" "grey35 " "$DEFAULT_COLOR" "$symfony2_version" 'SYMFONY_ICON'
fi
fi
}
}
@ -1260,7 +1264,7 @@ prompt_todo() {
if $(hash todo.sh 2>&-); then
if $(hash todo.sh 2>&-); then
count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }')
count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }')
if [[ "$count" = <-> ]]; then
if [[ "$count" = <-> ]]; then
"$1_prompt_segment" "$0" "$2" "244 " "$DEFAULT_COLOR" "$count" 'TODO_ICON'
"$1_prompt_segment" "$0" "$2" "grey50 " "$DEFAULT_COLOR" "$count" 'TODO_ICON'
fi
fi
fi
fi
}
}
@ -1407,7 +1411,7 @@ prompt_swift_version() {
# dir_writable: Display information about the user's permission to write in the current directory
# dir_writable: Display information about the user's permission to write in the current directory
prompt_dir_writable() {
prompt_dir_writable() {
if [[ ! -w "$PWD" ]]; then
if [[ ! -w "$PWD" ]]; then
"$1_prompt_segment" "$0_FORBIDDEN" "$2" "red" "226 " "" 'LOCK_ICON'
"$1_prompt_segment" "$0_FORBIDDEN" "$2" "red" "yellow1 " "" 'LOCK_ICON'
fi
fi
}
}