Merge pull request #684 from Artistan/color_names
Use color names, plus fixes
This commit is contained in:
commit
3d79ca1adc
7 changed files with 292 additions and 38 deletions
|
@ -570,7 +570,7 @@ prompt_context() {
|
|||
typeset -AH context_states
|
||||
context_states=(
|
||||
"ROOT" "yellow"
|
||||
"DEFAULT" "011"
|
||||
"DEFAULT" "yellow"
|
||||
)
|
||||
|
||||
local content=""
|
||||
|
@ -613,7 +613,7 @@ prompt_user() {
|
|||
"STATE" "DEFAULT"
|
||||
"CONTENT" "$(whoami)"
|
||||
"BACKGROUND_COLOR" "${DEFAULT_COLOR}"
|
||||
"FOREGROUND_COLOR" "011"
|
||||
"FOREGROUND_COLOR" "yellow"
|
||||
"VISUAL_IDENTIFIER" "USER_ICON"
|
||||
)
|
||||
fi
|
||||
|
@ -640,7 +640,7 @@ prompt_host() {
|
|||
"STATE" "LOCAL"
|
||||
"CONTENT" "${POWERLEVEL9K_HOST_TEMPLATE}"
|
||||
"BACKGROUND_COLOR" "${DEFAULT_COLOR}"
|
||||
"FOREGROUND_COLOR" "011"
|
||||
"FOREGROUND_COLOR" "yellow"
|
||||
"VISUAL_IDENTIFIER" "HOST_ICON"
|
||||
)
|
||||
fi
|
||||
|
@ -687,7 +687,7 @@ prompt_command_execution_time() {
|
|||
fi
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -702,10 +702,10 @@ prompt_dir() {
|
|||
|
||||
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
|
||||
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)
|
||||
current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,")" )
|
||||
current_path=$(truncatePathFromRight "$current_path" )
|
||||
;;
|
||||
truncate_with_package_name)
|
||||
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
|
||||
# from the package.json and append the current subdirectory
|
||||
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
|
||||
current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,")" )
|
||||
current_path=$(truncatePathFromRight "$current_path" )
|
||||
fi
|
||||
;;
|
||||
truncate_with_folder_marker)
|
||||
|
@ -859,13 +863,13 @@ prompt_go_version() {
|
|||
go_path=$(go env GOPATH 2>/dev/null)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
# Command number (in local 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)
|
||||
|
@ -1027,7 +1031,7 @@ prompt_nodeenv() {
|
|||
|
||||
# print a little 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
|
||||
|
@ -1036,7 +1040,7 @@ prompt_php_version() {
|
|||
php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*")
|
||||
|
||||
if [[ -n "$php_version" ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "013" "255" "$php_version"
|
||||
"$1_prompt_segment" "$0" "$2" "fuchsia" "grey93" "$php_version"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1102,7 +1106,7 @@ prompt_rust_version() {
|
|||
rust_version=$(rustc --version 2>&1 | grep -oe "^rustc\s*[^ ]*" | grep -o '[0-9.a-z\\\-]*$')
|
||||
|
||||
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
|
||||
}
|
||||
# RSpec test ratio
|
||||
|
@ -1121,7 +1125,7 @@ prompt_rvm() {
|
|||
local version_and_gemset=${rvm_env_string/ruby-}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -1177,7 +1181,7 @@ prompt_status() {
|
|||
|
||||
if (( ec_sum > 0 )); 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
|
||||
"$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON'
|
||||
fi
|
||||
|
@ -1226,7 +1230,7 @@ prompt_symfony2_version() {
|
|||
if [[ -f app/bootstrap.php.cache ]]; then
|
||||
local symfony2_version
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -1260,7 +1264,7 @@ prompt_todo() {
|
|||
if $(hash todo.sh 2>&-); then
|
||||
count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }')
|
||||
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
|
||||
}
|
||||
|
@ -1407,7 +1411,7 @@ prompt_swift_version() {
|
|||
# dir_writable: Display information about the user's permission to write in the current directory
|
||||
prompt_dir_writable() {
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue