This commit is contained in:
Tim Noise
2017-12-16 16:37:27 +11:00
103 changed files with 4669 additions and 609 deletions

View File

@@ -1,4 +1,8 @@
# Define this here so it can be used by all of the Powerline themes
THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true}
function set_color {
set +u
if [[ "${1}" != "-" ]]; then
fg="38;5;${1}"
fi
@@ -10,9 +14,16 @@ function set_color {
}
function __powerline_user_info_prompt {
local user_info=${USER}
set +u
local user_info=""
local color=${USER_INFO_THEME_PROMPT_COLOR}
if [[ "${THEME_CHECK_SUDO}" = true ]]; then
if sudo -n uptime 2>&1 | grep -q "load"; then
color=${USER_INFO_THEME_PROMPT_COLOR_SUDO}
fi
fi
case "${POWERLINE_PROMPT_USER_INFO_MODE}" in
"sudo")
if sudo -n true >/dev/null 2>&1; then
@@ -22,7 +33,7 @@ function __powerline_user_info_prompt {
;;
*)
if [[ -n "${SSH_CLIENT}" ]]; then
user_info="${USER_INFO_SSH_CHAR}${USER}"
user_info="${USER_INFO_SSH_CHAR}${USER}@${SHORT_HOSTNAME:=$HOSTNAME}"
else
user_info="${USER}"
fi
@@ -34,9 +45,9 @@ function __powerline_user_info_prompt {
function __powerline_ruby_prompt {
local ruby_version=""
if command_exists rvm; then
if _command_exists rvm; then
ruby_version="$(rvm_version_prompt)"
elif command_exists rbenv; then
elif _command_exists rbenv; then
ruby_version=$(rbenv_version_prompt)
fi
@@ -44,6 +55,7 @@ function __powerline_ruby_prompt {
}
function __powerline_python_venv_prompt {
set +u
local python_venv=""
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
@@ -93,6 +105,10 @@ function __powerline_hostname_prompt {
echo "$(hostname -s)|${HOST_THEME_PROMPT_COLOR}"
}
function __powerline_wd_prompt {
echo "\W|${CWD_THEME_PROMPT_COLOR}"
}
function __powerline_clock_prompt {
echo "$(date +"${THEME_CLOCK_FORMAT}")|${CLOCK_THEME_PROMPT_COLOR}"
}