Skip to content

Kig/powerline fixes #2325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
509 changes: 509 additions & 0 deletions README.md

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions colorschemes/colorscheme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# vim: ft=bash:

# @author: Konstantin Gredeskoul
# @since: 04/08/2021

# @description Defines a functino for quickly changing theme color

function bashit.colorscheme() {
local scheme="$1"

[[ -z "${scheme}" ]] && {
if [[ "${ITERM_PROFILE}" =~ "Light" || "${ITERM_PROFILE}" =~ "light" ]]; then
export scheme=light
else
export scheme=dark
fi
}

local theme="${BASH_IT}/colorschemes/${scheme}.colorscheme.bash"
if [[ -f ${theme} ]]; then
source "${theme}"

Check warning

Code scanning / shellcheck

SC1090 Warning

ShellCheck can't follow non-constant source. Use a directive to specify location.
else
echo "Invlaid theme name: ${scheme}, file ${theme} ain't a livin thang."
fi
}

function promptly.color() {
bashit.colorsscheme "$@"
}

export THEME_RUBRIC="ruby scm cwd | time "

function promptly() {
echo
}

function promptlyt() {
echo
}

function powerline.prompt.templates() {
local t=${1}

Check warning

Code scanning / shellcheck

SC2034 Warning

t appears unused. Verify use (or export if used externally).
bashit.colorsscheme "$@"
}

powerline.prompt.git.max

powerline.prompt.left aws ruby haskell go scm cwd
powerline.prompt.right user_info clock battery

bashit.colorscheme dark

23 changes: 23 additions & 0 deletions colorschemes/dark.colorscheme.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CLOCK_THEME_PROMPT_COLOR=124

Check warning

Code scanning / shellcheck

SC2034 Warning

CLOCK_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
CWD_THEME_PROMPT_COLOR=111

Check warning

Code scanning / shellcheck

SC2034 Warning

CWD_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
HOST_THEME_PROMPT_COLOR=99

Check warning

Code scanning / shellcheck

SC2034 Warning

HOST_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_CLEAN_COLOR=4

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_CLEAN_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_STAGED_COLOR=2563

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_STAGED_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_DIRTY_COLOR=2561

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_DIRTY_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_UNSTAGED_COLOR=209

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_UNSTAGED_COLOR appears unused. Verify use (or export if used externally).
USER_INFO_THEME_PROMPT_COLOR=126

Check warning

Code scanning / shellcheck

SC2034 Warning

USER_INFO_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
GO_THEME_PROMPT_COLOR=19

Check warning

Code scanning / shellcheck

SC2034 Warning

GO_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
POWERLINE_GO_COLOR=33

Check warning

Code scanning / shellcheck

SC2034 Warning

POWERLINE_GO_COLOR appears unused. Verify use (or export if used externally).
NODE_THEME_PROMPT_COLOR=26

Check warning

Code scanning / shellcheck

SC2034 Warning

NODE_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).

#CLOCK_THEME_PROMPT_COLOR=214
#CWD_THEME_PROMPT_COLOR=123
#HOST_THEME_PROMPT_COLOR=9
#RUBY_THEME_PROMPT_COLOR=202
#SCM_THEME_PROMPT_CLEAN_COLOR=560
#SCM_THEME_PROMPT_STAGED_COLOR=1251
#SCM_THEME_PROMPT_UNSTAGED_COLOR=209
#USER_INFO_THEME_PROMPT_COLOR=46
#GO_THEME_PROMPT_COLOR=33
#POWERLINE_GO_COLOR=33

11 changes: 11 additions & 0 deletions colorschemes/light.colorscheme.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CLOCK_THEME_PROMPT_COLOR=131

Check warning

Code scanning / shellcheck

SC2034 Warning

CLOCK_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
CWD_THEME_PROMPT_COLOR=153

Check warning

Code scanning / shellcheck

SC2034 Warning

CWD_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
HOST_THEME_PROMPT_COLOR=9

Check warning

Code scanning / shellcheck

SC2034 Warning

HOST_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
RUBY_THEME_PROMPT_COLOR=202

Check warning

Code scanning / shellcheck

SC2034 Warning

RUBY_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_CLEAN_COLOR=177

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_CLEAN_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_DIRTY_COLOR=220

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_DIRTY_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_STAGED_COLOR=1251

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_STAGED_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_UNSTAGED_COLOR=209

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_UNSTAGED_COLOR appears unused. Verify use (or export if used externally).
USER_INFO_THEME_PROMPT_COLOR=46

Check warning

Code scanning / shellcheck

SC2034 Warning

USER_INFO_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
GO_THEME_PROMPT_COLOR=33

Check warning

Code scanning / shellcheck

SC2034 Warning

GO_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
POWERLINE_GO_COLOR=33

Check warning

Code scanning / shellcheck

SC2034 Warning

POWERLINE_GO_COLOR appears unused. Verify use (or export if used externally).
24 changes: 24 additions & 0 deletions colorschemes/tango.colorscheme.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
CLOCK_THEME_PROMPT_COLOR=93

Check warning

Code scanning / shellcheck

SC2034 Warning

CLOCK_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
CLOUD_THEME_PROMPT_COLOR=161

Check warning

Code scanning / shellcheck

SC2034 Warning

CLOUD_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
COMMAND_NUMBER_THEME_PROMPT_COLOR=24

Check warning

Code scanning / shellcheck

SC2034 Warning

COMMAND_NUMBER_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
CWD_THEME_PROMPT_COLOR=23

Check warning

Code scanning / shellcheck

SC2034 Warning

CWD_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
DIRSTACK_THEME_PROMPT_COLOR=190

Check warning

Code scanning / shellcheck

SC2034 Warning

DIRSTACK_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
HISTORY_NUMBER_THEME_PROMPT_COLOR=234

Check warning

Code scanning / shellcheck

SC2034 Warning

HISTORY_NUMBER_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
HOST_THEME_PROMPT_COLOR=133

Check warning

Code scanning / shellcheck

SC2034 Warning

HOST_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
IN_TOOLBOX_THEME_PROMPT_COLOR=125

Check warning

Code scanning / shellcheck

SC2034 Warning

IN_TOOLBOX_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
IN_VIM_THEME_PROMPT_COLOR=245

Check warning

Code scanning / shellcheck

SC2034 Warning

IN_VIM_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26

Check warning

Code scanning / shellcheck

SC2034 Warning

KUBERNETES_CONTEXT_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
LAST_STATUS_THEME_PROMPT_COLOR=52

Check warning

Code scanning / shellcheck

SC2034 Warning

LAST_STATUS_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
NODE_THEME_PROMPT_COLOR=22

Check warning

Code scanning / shellcheck

SC2034 Warning

NODE_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
PYTHON_VENV_THEME_PROMPT_COLOR=35

Check warning

Code scanning / shellcheck

SC2034 Warning

PYTHON_VENV_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
RUBY_THEME_PROMPT_COLOR=161

Check warning

Code scanning / shellcheck

SC2034 Warning

RUBY_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
SHLVL_THEME_PROMPT_COLOR=123

Check warning

Code scanning / shellcheck

SC2034 Warning

SHLVL_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
TERRAFORM_THEME_PROMPT_COLOR=161

Check warning

Code scanning / shellcheck

SC2034 Warning

TERRAFORM_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
USER_INFO_THEME_PROMPT_COLOR_SUDO=202

Check warning

Code scanning / shellcheck

SC2034 Warning

USER_INFO_THEME_PROMPT_COLOR_SUDO appears unused. Verify use (or export if used externally).

SCM_THEME_PROMPT_COLOR=37

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_CLEAN_COLOR=324

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_CLEAN_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_STAGED_COLOR=2513

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_STAGED_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_DIRTY_COLOR=2519

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_DIRTY_COLOR appears unused. Verify use (or export if used externally).
SCM_THEME_PROMPT_UNSTAGED_COLOR=209

Check warning

Code scanning / shellcheck

SC2034 Warning

SCM_THEME_PROMPT_UNSTAGED_COLOR appears unused. Verify use (or export if used externally).

Binary file added images/dark-colorscheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/light-colorscheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
209 changes: 183 additions & 26 deletions themes/base.theme.bash
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
function git_prompt_minimal_info() {
SCM_STATE="${SCM_THEME_PROMPT_CLEAN?}"

_git-hide-status && return
_git-hide-status && return

SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX-}\$(_git-friendly-ref)"

Expand All @@ -256,11 +256,11 @@
SCM_GIT_GITSTATUS_RAN=false
fi

if _git-branch &> /dev/null; then
SCM_GIT_DETACHED="false"
SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)$(_git-remote-info)"
else
SCM_GIT_DETACHED="true"
if _git-branch &>/dev/null; then
SCM_GIT_DETACHED="false"
SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)$(_git-remote-info)"
else
SCM_GIT_DETACHED="true"

local detached_prefix
if _git-tag &> /dev/null; then
Expand Down Expand Up @@ -316,8 +316,8 @@
fi
fi

# no if for gitstatus here, user extraction is not supported by it
[[ "${SCM_GIT_SHOW_CURRENT_USER}" == "true" ]] && SCM_BRANCH+="$(git_user_info)"
# no if for gitstatus here, user extraction is not supported by it
[[ "${SCM_GIT_SHOW_CURRENT_USER}" == "true" ]] && SCM_BRANCH+="$(git_user_info)"

SCM_PREFIX="${GIT_THEME_PROMPT_PREFIX:-${SCM_THEME_PROMPT_PREFIX-}}"
SCM_SUFFIX="${GIT_THEME_PROMPT_SUFFIX:-${SCM_THEME_PROMPT_SUFFIX-}}"
Expand Down Expand Up @@ -382,14 +382,14 @@
bookmark="${hg_root}/bookmarks.current"
[[ -f "${bookmark}" ]] && SCM_BRANCH+=:$(< "${bookmark}")
else
SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}')
SCM_BRANCH=$(hg summary 2>/dev/null | grep branch: | awk '{print $2}')
fi

if [[ -f "$hg_root/dirstate" ]]; then
# Mercurial holds various information about the working directory in .hg/dirstate file. More on http://mercurial.selenic.com/wiki/DirState
SCM_CHANGE=$(hexdump -vn 10 -e '1/1 "%02x"' "$hg_root/dirstate" | cut -c-12)
else
SCM_CHANGE=$(hg summary 2> /dev/null | grep parent: | awk '{print $2}')
SCM_CHANGE=$(hg summary 2>/dev/null | grep parent: | awk '{print $2}')
fi
}

Expand All @@ -411,7 +411,7 @@
}

function node_version_prompt() {
NODE_VERSION_STRATEGY="${NODE_VERSION_STRATEGY:-nvm}"
NODE_VERSION_STRATEGY="${NODE_VERSION_STRATEGY:-node}"

_log_debug "node: using version strategy '$NODE_VERSION_STRATEGY'"

Expand Down Expand Up @@ -447,19 +447,82 @@
fi
}

# BEGIN ORIGIN CODE
function chruby_version_prompt() {
if _is_function chruby; then
if _is_function chruby_auto; then
chruby_auto
fi

ruby_version=$(ruby --version | awk '{print $1, $2;}') || return
ruby_version=$(ruby --version | awk '{print $1, $2;}') || return

if ! chruby | grep -q '\*'; then
ruby_version="${ruby_version} (system)"
fi
echo -ne "${CHRUBY_THEME_PROMPT_PREFIX-}${ruby_version}${CHRUBY_THEME_PROMPT_SUFFIX-}"
fi
if ! chruby | grep -q '\*'; then
ruby_version="${ruby_version} (system)"
fi
echo -e "${CHRUBY_THEME_PROMPT_PREFIX}${ruby_version}${CHRUBY_THEME_PROMPT_SUFFIX}"
fi
}

function ruby_version_prompt {
if [[ "${THEME_SHOW_RUBY_PROMPT}" = "true" ]]; then

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)$(chruby_version_prompt)"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
fi

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function k8s_context_prompt {
echo -e "$(kubectl config current-context 2>/dev/null)"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function virtualenv_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
virtualenv=$(basename "$VIRTUAL_ENV")

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
fi

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function condaenv_prompt {
if [[ $CONDA_DEFAULT_ENV ]]; then

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
echo -e "${CONDAENV_THEME_PROMPT_PREFIX}${CONDA_DEFAULT_ENV}${CONDAENV_THEME_PROMPT_SUFFIX}"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
fi

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function py_interp_prompt {
py_version=$(python --version 2>&1 | awk 'NR==1{print "py-"$2;}') || return

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
echo -e "${PYTHON_THEME_PROMPT_PREFIX}${py_version}${PYTHON_THEME_PROMPT_SUFFIX}"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function python_version_prompt {
echo -e "$(virtualenv_prompt)$(condaenv_prompt)$(py_interp_prompt)"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function git_user_info {
# support two or more initials, set by 'git pair' plugin
SCM_CURRENT_USER=$(git config user.initials | sed 's% %+%')

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
# if `user.initials` weren't set, attempt to extract initials from `user.name`
[[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" "$(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done)")

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
[[ -n "${SCM_CURRENT_USER}" ]] && printf "%s" "$SCM_THEME_CURRENT_USER_PREFFIX$SCM_CURRENT_USER$SCM_THEME_CURRENT_USER_SUFFIX"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function clock_char {
CLOCK_CHAR=${THEME_CLOCK_CHAR:-"⌚"}

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"$normal"}

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"}

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

if [[ "${SHOW_CLOCK_CHAR}" = "true" ]]; then

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
echo -e "${CLOCK_CHAR_COLOR}${CLOCK_CHAR_THEME_PROMPT_PREFIX}${CLOCK_CHAR}${CLOCK_CHAR_THEME_PROMPT_SUFFIX}"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
fi

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function clock_prompt {
CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$normal"}

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H:%M:%S"}

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
[ -z "$THEME_SHOW_CLOCK" ] && THEME_SHOW_CLOCK=${THEME_CLOCK_CHECK:-"true"}

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
SHOW_CLOCK=$THEME_SHOW_CLOCK

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

if [[ "${SHOW_CLOCK}" = "true" ]]; then

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
CLOCK_STRING=$(date +"${CLOCK_FORMAT}")

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
echo -e "${CLOCK_COLOR}${CLOCK_THEME_PROMPT_PREFIX}${CLOCK_STRING}${CLOCK_THEME_PROMPT_SUFFIX}"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
fi

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}

function ruby_version_prompt() {
Expand Down Expand Up @@ -589,6 +652,92 @@
}
fi

# The battery_char function depends on the presence of the battery_percentage function.
# If battery_percentage is not defined, then define battery_char as a no-op.
if ! _command_exists battery_percentage; then
function battery_char() {
# no op
echo -n
}
fi

function aws_profile {
if [[ $AWS_DEFAULT_PROFILE ]]; then

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
echo -e "${AWS_DEFAULT_PROFILE}"

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
else
echo -e "default"
fi

Check warning

Code scanning / shellcheck

SC2317 Warning

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
}


function npm_version_prompt() {
local node
if declare -f -F npm &>/dev/null; then
node=$(nvm current 2>/dev/null)
[[ "${node}" == "system" ]] && return
echo -e "${NVM_THEME_PROMPT_PREFIX}${node}${NVM_THEME_PROMPT_SUFFIX}"
fi
}

function prompt_colorscheme() {
[[ -z "${BASH_IT_COLORSCHEME}" ]] && return

local -a colorscheme_locations=(
"${HOME}/.${BASH_IT_COLORSCHEME}.colorscheme.bash"
"$BASH_IT/custom/${BASH_IT_COLORSCHEME}.colorscheme.bash"
"$BASH_IT/colorschemes/${BASH_IT_COLORSCHEME}.colorscheme.bash"
)

for scheme_file in ${colorscheme_locations[@]}; do
if [[ -f ${scheme_file} ]]; then
source "${scheme_file}"
fi
done
}

function __check_precmd_conflict() {
local f
for f in "${precmd_functions[@]}"; do
if [[ "${f}" == "${1}" ]]; then
return 0
fi
done
return 1
}

function _save-and-reload-history() {
local autosave=${1:-0}
[[ $autosave -eq 1 ]] && history -a && history -c && history -r
}

function safe_append_prompt_command {
local prompt_re

if [ "${__bp_imported}" == "defined" ]; then
# We are using bash-preexec
if ! __check_precmd_conflict "${1}"; then
precmd_functions+=("${1}")
fi
else
# Set OS dependent exact match regular expression
if [[ ${OSTYPE} == darwin* ]]; then
# macOS
prompt_re="[[:<:]]${1}[[:>:]]"
else
# Linux, FreeBSD, etc.
prompt_re="\<${1}\>"
fi

if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then
return
elif [[ -z ${PROMPT_COMMAND} ]]; then
PROMPT_COMMAND="${1}"
else
PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
fi
fi
}

function aws_profile() {
if [[ -n "${AWS_PROFILE:-}" ]]; then
echo -ne "${AWS_PROFILE}"
Expand All @@ -600,15 +749,23 @@
}

function _save-and-reload-history() {
local autosave="${1:-${HISTORY_AUTOSAVE:-0}}"
[[ ${autosave} -eq 1 ]] && local HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autoshare"
_bash-it-history-auto-save && _bash-it-history-auto-load
local autosave=${1:-0}
[[ $autosave -eq 1 ]] && history -a && history -c && history -r
}

function conda_or_venv_prompt() {
if [[ -n "${CONDA_DEFAULT_ENV:-}" ]]; then
condaenv_prompt
elif [[ -n "${VIRTUAL_ENV:-}" ]]; then
virtualenv_prompt
fi
function prompt_colorscheme() {
[[ -z "${BASH_IT_COLORSCHEME}" ]] && return

local -a colorscheme_locations=(
"${HOME}/.${BASH_IT_COLORSCHEME}.colorscheme.bash"
"$BASH_IT/custom/${BASH_IT_COLORSCHEME}.colorscheme.bash"
"$BASH_IT/colorschemes/${BASH_IT_COLORSCHEME}.colorscheme.bash"
)

for scheme_file in "${colorscheme_locations[@]}"; do
if [[ -f ${scheme_file} ]]; then

source "${scheme_file}"
fi
done
}
Loading