Merge branch 'master' into vendor
commit
9b04e11bfc
|
|
@ -39,6 +39,13 @@ themes/barbuk
|
|||
themes/atomic
|
||||
themes/axin
|
||||
themes/base.theme.bash
|
||||
themes/bakke
|
||||
themes/binaryanomaly
|
||||
themes/bira
|
||||
themes/bobby
|
||||
themes/bobby-python
|
||||
themes/brainy
|
||||
themes/brunton
|
||||
themes/command_duration.theme.bash
|
||||
|
||||
# plugins
|
||||
|
|
@ -56,6 +63,7 @@ completion/available/pipx.completion.bash
|
|||
completion/available/rustup.completion.bash
|
||||
completion/available/vault.completion.bash
|
||||
completion/available/sdkman.completion.bash
|
||||
completion/available/vuejs.completion.bash
|
||||
|
||||
# aliases
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,49 +1,59 @@
|
|||
#!/usr/bin/bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
if _command_exists vue; then
|
||||
__vuejs_completion() {
|
||||
local prev=$(_get_pword)
|
||||
local curr=$(_get_cword)
|
||||
__vuejs_completion() {
|
||||
local prev=$(_get_pword)
|
||||
local curr=$(_get_cword)
|
||||
|
||||
case $prev in
|
||||
create)
|
||||
COMPREPLY=($(compgen -W "-p -d -i -m -r -g -n -f -c -x -b -h --help --preset --default --inilinePreset --packageManager --registry --git --no-git --force --merge --clone --proxy --bare --skipGetStarted" -- "$curr"))
|
||||
;;
|
||||
add|invoke)
|
||||
COMPREPLY=($(compgen -W "--registry -h --help" -- "$curr"))
|
||||
;;
|
||||
inspect)
|
||||
COMPREPLY=($(compgen -W "-v --help --verbose --mode --rule --plugin --plugins --rules" -- "$curr"))
|
||||
;;
|
||||
serve)
|
||||
COMPREPLY=($(compgen -W "-o -h --help --open -c --copy -p --port" -- "$curr"))
|
||||
;;
|
||||
build)
|
||||
COMPREPLY=($(compgen -W "-t --target -n --name -d --dest -h --help" -- "$curr"))
|
||||
;;
|
||||
ui)
|
||||
COMPREPLY=($(compgen -W "-H --host -p --port -D --dev --quiet --headless -h --help" -- "$curr"))
|
||||
;;
|
||||
init)
|
||||
COMPREPLY=($(compgen -W "-c --clone --offline -h --help" -- "$curr"))
|
||||
;;
|
||||
config)
|
||||
COMPREPLY=($(compgen -W "-g --get -s --set -d --delete -e --edit --json -h --help" -- "$curr"))
|
||||
;;
|
||||
outdated)
|
||||
COMPREPLY=($(compgen -W "--next -h --help" -- "$curr"))
|
||||
;;
|
||||
upgrade)
|
||||
COMPREPLY=($(compgen -W "-t --to -f --from -r --registry --all --next -h --help" -- "$curr"))
|
||||
;;
|
||||
migrate)
|
||||
COMPREPLY=($(compgen -W "-f --from -h --help" -- "$curr"))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr"))
|
||||
;;
|
||||
esac
|
||||
}
|
||||
case $prev in
|
||||
create)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-p -d -i -m -r -g -n -f -c -x -b -h --help --preset --default --inilinePreset --packageManager --registry --git --no-git --force --merge --clone --proxy --bare --skipGetStarted" -- "$curr"))
|
||||
;;
|
||||
add | invoke)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "--registry -h --help" -- "$curr"))
|
||||
;;
|
||||
inspect)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-v --help --verbose --mode --rule --plugin --plugins --rules" -- "$curr"))
|
||||
;;
|
||||
serve)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-o -h --help --open -c --copy -p --port" -- "$curr"))
|
||||
;;
|
||||
build)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-t --target -n --name -d --dest -h --help" -- "$curr"))
|
||||
;;
|
||||
ui)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-H --host -p --port -D --dev --quiet --headless -h --help" -- "$curr"))
|
||||
;;
|
||||
init)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-c --clone --offline -h --help" -- "$curr"))
|
||||
;;
|
||||
config)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-g --get -s --set -d --delete -e --edit --json -h --help" -- "$curr"))
|
||||
;;
|
||||
outdated)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "--next -h --help" -- "$curr"))
|
||||
;;
|
||||
upgrade)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-t --to -f --from -r --registry --all --next -h --help" -- "$curr"))
|
||||
;;
|
||||
migrate)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-f --from -h --help" -- "$curr"))
|
||||
;;
|
||||
*)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr"))
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F __vuejs_completion vue
|
||||
fi
|
||||
complete -F __vuejs_completion vue
|
||||
|
|
|
|||
|
|
@ -225,17 +225,15 @@ _atomic_completion() {
|
|||
actions="show hide"
|
||||
segments="battery clock exitcode python ruby scm sudo todo"
|
||||
case "${_action}" in
|
||||
show)
|
||||
read -r -a COMPREPLY <<< "$(compgen -W "${segments}" -- "${cur}")"
|
||||
return 0
|
||||
;;
|
||||
hide)
|
||||
read -r -a COMPREPLY <<< "$(compgen -W "${segments}" -- "${cur}")"
|
||||
show | hide)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${segments}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
read -r -a COMPREPLY <<< "$(compgen -W "${actions}" -- "${cur}")"
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${actions}" -- "${cur}"))
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||
SCM_THEME_PROMPT_PREFIX=" |"
|
||||
|
|
@ -13,10 +14,10 @@ RVM_THEME_PROMPT_PREFIX="|"
|
|||
RVM_THEME_PROMPT_SUFFIX="|"
|
||||
|
||||
function prompt_command() {
|
||||
#PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} "
|
||||
#PS1="\n${purple}\h: ${reset_color} ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} "
|
||||
#PS1="\n${cyan}\h: ${reset_color} ${yellow}\w\n${red}$(scm_char)${red}$(scm_prompt_info) ${green}→${reset_color} "
|
||||
PS1="\n${cyan}\h:$(virtualenv_prompt) ${reset_color} ${yellow}\w ${green}$(scm_prompt_info)\n${reset_color}→ "
|
||||
#PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} "
|
||||
#PS1="\n${purple}\h: ${reset_color} ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} "
|
||||
#PS1="\n${cyan}\h: ${reset_color} ${yellow}\w\n${red}$(scm_char)${red}$(scm_prompt_info) ${green}→${reset_color} "
|
||||
PS1="\n${cyan}\h:$(virtualenv_prompt) ${reset_color} ${yellow}\w ${green}$(scm_prompt_info)\n${reset_color}→ "
|
||||
}
|
||||
|
||||
safe_append_prompt_command prompt_command
|
||||
|
|
|
|||
|
|
@ -1,80 +1,78 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Detect whether a reboot is required
|
||||
function show_reboot_required() {
|
||||
if [ ! -z "$_bf_prompt_reboot_info" ]; then
|
||||
if [ -f /var/run/reboot-required ]; then
|
||||
printf "Reboot required!"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$_bf_prompt_reboot_info" ]; then
|
||||
if [ -f /var/run/reboot-required ]; then
|
||||
printf "Reboot required!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Set different host color for local and remote sessions
|
||||
function set_host_color() {
|
||||
# Detect if connection is through SSH
|
||||
if [[ ! -z $SSH_CLIENT ]]; then
|
||||
printf "${lime_yellow}"
|
||||
else
|
||||
printf "${light_orange}"
|
||||
fi
|
||||
# Detect if connection is through SSH
|
||||
if [[ -n $SSH_CLIENT ]]; then
|
||||
printf '%s' "${lime_yellow}"
|
||||
else
|
||||
printf '%s' "${light_orange}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Set different username color for users and root
|
||||
function set_user_color() {
|
||||
case $(id -u) in
|
||||
0)
|
||||
printf "${red}"
|
||||
;;
|
||||
*)
|
||||
printf "${cyan}"
|
||||
;;
|
||||
esac
|
||||
case $(id -u) in
|
||||
0)
|
||||
printf '%s' "${red}"
|
||||
;;
|
||||
*)
|
||||
printf '%s' "${cyan}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
scm_prompt() {
|
||||
CHAR=$(scm_char)
|
||||
if [ $CHAR = $SCM_NONE_CHAR ]
|
||||
then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)$(scm_prompt_info)]"
|
||||
fi
|
||||
CHAR=$(scm_char)
|
||||
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
# Define custom colors we need
|
||||
# non-printable bytes in PS1 need to be contained within \[ \].
|
||||
# Otherwise, bash will count them in the length of the prompt
|
||||
function set_custom_colors() {
|
||||
dark_grey="\[$(tput setaf 8)\]"
|
||||
light_grey="\[$(tput setaf 248)\]"
|
||||
dark_grey="\[$(tput setaf 8)\]"
|
||||
light_grey="\[$(tput setaf 248)\]"
|
||||
|
||||
light_orange="\[$(tput setaf 172)\]"
|
||||
bright_yellow="\[$(tput setaf 220)\]"
|
||||
lime_yellow="\[$(tput setaf 190)\]"
|
||||
light_orange="\[$(tput setaf 172)\]"
|
||||
bright_yellow="\[$(tput setaf 220)\]"
|
||||
lime_yellow="\[$(tput setaf 190)\]"
|
||||
|
||||
powder_blue="\[$(tput setaf 153)\]"
|
||||
powder_blue="\[$(tput setaf 153)\]"
|
||||
}
|
||||
|
||||
__ps_time() {
|
||||
echo "$(clock_prompt)${normal}\n"
|
||||
printf '%s' "$(clock_prompt)${normal}\n"
|
||||
}
|
||||
|
||||
function prompt_command() {
|
||||
ps_reboot="${bright_yellow}$(show_reboot_required)${normal}\n"
|
||||
ps_reboot="${bright_yellow}$(show_reboot_required)${normal}\n"
|
||||
|
||||
ps_username="$(set_user_color)\u${normal}"
|
||||
ps_uh_separator="${dark_grey}@${normal}"
|
||||
ps_hostname="$(set_host_color)\h${normal}"
|
||||
ps_username="$(set_user_color)\u${normal}"
|
||||
ps_uh_separator="${dark_grey}@${normal}"
|
||||
ps_hostname="$(set_host_color)\h${normal}"
|
||||
|
||||
ps_path="${yellow}\w${normal}"
|
||||
ps_scm_prompt="${light_grey}$(scm_prompt)"
|
||||
ps_path="${yellow}\w${normal}"
|
||||
ps_scm_prompt="${light_grey}$(scm_prompt)"
|
||||
|
||||
ps_user_mark="${normal} ${normal}"
|
||||
ps_user_input="${normal}"
|
||||
ps_user_mark="${normal} ${normal}"
|
||||
ps_user_input="${normal}"
|
||||
|
||||
# Set prompt
|
||||
PS1="$ps_reboot$(__ps_time)$ps_username$ps_uh_separator$ps_hostname $ps_path $ps_scm_prompt$ps_user_mark$ps_user_input"
|
||||
# Set prompt
|
||||
PS1="$ps_reboot$(__ps_time)$ps_username$ps_uh_separator$ps_hostname $ps_path $ps_scm_prompt$ps_user_mark$ps_user_input"
|
||||
}
|
||||
|
||||
# Initialize custom colors
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX=" ${yellow}‹"
|
||||
SCM_THEME_PROMPT_SUFFIX="›${reset_color}"
|
||||
|
|
@ -9,14 +9,14 @@ VIRTUALENV_THEME_PROMPT_SUFFIX="›${reset_color}"
|
|||
bold="\[\e[1m\]"
|
||||
|
||||
if [ ${UID} -eq 0 ]; then
|
||||
user_host="${bold_red}\u@\h${normal}${reset_color}"
|
||||
user_host="${bold_red}\u@\h${normal}${reset_color}"
|
||||
else
|
||||
user_host="${bold_green}\u@\h${normal}${reset_color}"
|
||||
user_host="${bold_green}\u@\h${normal}${reset_color}"
|
||||
fi
|
||||
|
||||
function prompt_command() {
|
||||
local current_dir=" ${bold_blue}\w${normal}${reset_color}"
|
||||
PS1="╭─${user_host}${current_dir}$(virtualenv_prompt)$(scm_prompt_info)\n╰─${bold}\\$ ${normal}"
|
||||
local current_dir=" ${bold_blue}\w${normal}${reset_color}"
|
||||
PS1="╭─${user_host}${current_dir}$(virtualenv_prompt)$(scm_prompt_info)\n╰─${bold}\\$ ${normal}"
|
||||
}
|
||||
|
||||
safe_append_prompt_command prompt_command
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||
SCM_THEME_PROMPT_PREFIX=" |"
|
||||
|
|
@ -12,13 +13,13 @@ GIT_THEME_PROMPT_SUFFIX="${green}|"
|
|||
CONDAENV_THEME_PROMPT_SUFFIX="|"
|
||||
|
||||
function prompt_command() {
|
||||
PS1="\n${yellow}$(python_version_prompt) " # Name of virtual env followed by python version
|
||||
PS1+="${purple}\h "
|
||||
PS1+="${reset_color}in "
|
||||
PS1+="${green}\w\n"
|
||||
PS1+="${bold_cyan}$(scm_char)"
|
||||
PS1+="${green}$(scm_prompt_info) "
|
||||
PS1+="${green}→${reset_color} "
|
||||
PS1="\n${yellow}$(python_version_prompt) " # Name of virtual env followed by python version
|
||||
PS1+="${purple}\h "
|
||||
PS1+="${reset_color}in "
|
||||
PS1+="${green}\w\n"
|
||||
PS1+="${bold_cyan}$(scm_char)"
|
||||
PS1+="${green}$(scm_prompt_info) "
|
||||
PS1+="${green}→${reset_color} "
|
||||
}
|
||||
|
||||
safe_append_prompt_command prompt_command
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||
|
|
@ -14,21 +14,21 @@ RVM_THEME_PROMPT_PREFIX="|"
|
|||
RVM_THEME_PROMPT_SUFFIX="|"
|
||||
|
||||
__bobby_clock() {
|
||||
printf "$(clock_prompt) "
|
||||
printf '%s' "$(clock_prompt) "
|
||||
|
||||
if [ "${THEME_SHOW_CLOCK_CHAR}" == "true" ]; then
|
||||
printf "$(clock_char) "
|
||||
fi
|
||||
if [ "${THEME_SHOW_CLOCK_CHAR}" == "true" ]; then
|
||||
printf '%s' "$(clock_char) "
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_command() {
|
||||
PS1="\n$(battery_char) $(__bobby_clock)"
|
||||
PS1+="${yellow}$(ruby_version_prompt) "
|
||||
PS1+="${purple}\h "
|
||||
PS1+="${reset_color}in "
|
||||
PS1+="${green}\w\n"
|
||||
PS1+="${bold_cyan}$(scm_prompt_char_info) "
|
||||
PS1+="${green}→${reset_color} "
|
||||
PS1="\n$(battery_char) $(__bobby_clock)"
|
||||
PS1+="${yellow}$(ruby_version_prompt) "
|
||||
PS1+="${purple}\h "
|
||||
PS1+="${reset_color}in "
|
||||
PS1+="${green}\w\n"
|
||||
PS1+="${bold_cyan}$(scm_prompt_char_info) "
|
||||
PS1+="${green}→${reset_color} "
|
||||
}
|
||||
|
||||
THEME_SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Brainy Bash Prompt for Bash-it
|
||||
# by MunifTanjim
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
____brainy_top_left_parse() {
|
||||
ifs_old="${IFS}"
|
||||
IFS="|"
|
||||
args=( $1 )
|
||||
read -r -a args <<< "$@"
|
||||
IFS="${ifs_old}"
|
||||
if [ -n "${args[3]}" ]; then
|
||||
_TOP_LEFT+="${args[2]}${args[3]}"
|
||||
|
|
@ -25,7 +25,7 @@ ____brainy_top_left_parse() {
|
|||
____brainy_top_right_parse() {
|
||||
ifs_old="${IFS}"
|
||||
IFS="|"
|
||||
args=( $1 )
|
||||
read -r -a args <<< "$@"
|
||||
IFS="${ifs_old}"
|
||||
_TOP_RIGHT+=" "
|
||||
if [ -n "${args[3]}" ]; then
|
||||
|
|
@ -35,14 +35,14 @@ ____brainy_top_right_parse() {
|
|||
if [ -n "${args[4]}" ]; then
|
||||
_TOP_RIGHT+="${args[2]}${args[4]}"
|
||||
fi
|
||||
__TOP_RIGHT_LEN=$(( __TOP_RIGHT_LEN + ${#args[1]} + ${#args[3]} + ${#args[4]} + 1 ))
|
||||
(( __SEG_AT_RIGHT += 1 ))
|
||||
__TOP_RIGHT_LEN=$((__TOP_RIGHT_LEN + ${#args[1]} + ${#args[3]} + ${#args[4]} + 1))
|
||||
((__SEG_AT_RIGHT += 1))
|
||||
}
|
||||
|
||||
____brainy_bottom_parse() {
|
||||
ifs_old="${IFS}"
|
||||
IFS="|"
|
||||
args=( $1 )
|
||||
read -r -a args <<< "$@"
|
||||
IFS="${ifs_old}"
|
||||
_BOTTOM+="${args[0]}${args[1]}"
|
||||
[ ${#args[1]} -gt 0 ] && _BOTTOM+=" "
|
||||
|
|
@ -67,7 +67,7 @@ ____brainy_top() {
|
|||
[ -n "${info}" ] && ____brainy_top_right_parse "${info}"
|
||||
done
|
||||
|
||||
[ $__TOP_RIGHT_LEN -gt 0 ] && __TOP_RIGHT_LEN=$(( __TOP_RIGHT_LEN - 1 ))
|
||||
[ $__TOP_RIGHT_LEN -gt 0 ] && __TOP_RIGHT_LEN=$((__TOP_RIGHT_LEN - 1))
|
||||
___cursor_adjust="\033[${__TOP_RIGHT_LEN}D"
|
||||
_TOP_LEFT+="${___cursor_adjust}"
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ ____brainy_bottom() {
|
|||
___brainy_prompt_user_info() {
|
||||
color=$bold_blue
|
||||
if [ "${THEME_SHOW_SUDO}" == "true" ]; then
|
||||
if sudo -vn 1>/dev/null 2>&1; then
|
||||
if sudo -vn 1> /dev/null 2>&1; then
|
||||
color=$bold_red
|
||||
fi
|
||||
fi
|
||||
|
|
@ -135,11 +135,11 @@ ___brainy_prompt_ruby() {
|
|||
}
|
||||
|
||||
___brainy_prompt_todo() {
|
||||
[ "${THEME_SHOW_TODO}" != "true" ] ||
|
||||
[ -z "$(which todo.sh)" ] && return
|
||||
[ "${THEME_SHOW_TODO}" != "true" ] \
|
||||
|| [ -z "$(which todo.sh)" ] && return
|
||||
color=$bold_white
|
||||
box="[|]"
|
||||
info="t:$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+)" | awk '{ print $4 }' )"
|
||||
info="t:$(todo.sh ls | grep -E "TODO: [0-9]+ of ([0-9]+)" | awk '{ print $4 }')"
|
||||
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_green}" "${box}"
|
||||
}
|
||||
|
||||
|
|
@ -152,9 +152,9 @@ ___brainy_prompt_clock() {
|
|||
}
|
||||
|
||||
___brainy_prompt_battery() {
|
||||
! _command_exists battery_percentage ||
|
||||
[ "${THEME_SHOW_BATTERY}" != "true" ] ||
|
||||
[ "$(battery_percentage)" = "no" ] && return
|
||||
! _command_exists battery_percentage \
|
||||
|| [ "${THEME_SHOW_BATTERY}" != "true" ] \
|
||||
|| [ "$(battery_percentage)" = "no" ] && return
|
||||
|
||||
info=$(battery_percentage)
|
||||
color=$bold_green
|
||||
|
|
@ -165,8 +165,8 @@ ___brainy_prompt_battery() {
|
|||
fi
|
||||
box="[|]"
|
||||
ac_adapter_connected && charging="+"
|
||||
ac_adapter_disconnected && charging="-"
|
||||
info+=$charging
|
||||
ac_adapter_disconnected && charging="-"
|
||||
info+=$charging
|
||||
[ "$info" == "100+" ] && info="AC"
|
||||
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}"
|
||||
}
|
||||
|
|
@ -188,15 +188,15 @@ ___brainy_prompt_char() {
|
|||
#########
|
||||
|
||||
__brainy_show() {
|
||||
typeset _seg=${1:-}
|
||||
typeset _seg=${1:-}
|
||||
shift
|
||||
export THEME_SHOW_${_seg}=true
|
||||
export "THEME_SHOW_${_seg}"=true
|
||||
}
|
||||
|
||||
__brainy_hide() {
|
||||
typeset _seg=${1:-}
|
||||
shift
|
||||
export THEME_SHOW_${_seg}=false
|
||||
export "THEME_SHOW_${_seg}"=false
|
||||
}
|
||||
|
||||
_brainy_completion() {
|
||||
|
|
@ -207,17 +207,15 @@ _brainy_completion() {
|
|||
actions="show hide"
|
||||
segments="battery clock exitcode python ruby scm sudo todo"
|
||||
case "${_action}" in
|
||||
show)
|
||||
COMPREPLY=( $(compgen -W "${segments}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
hide)
|
||||
COMPREPLY=( $(compgen -W "${segments}" -- "${cur}") )
|
||||
show | hide)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${segments}" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
COMPREPLY=( $(compgen -W "${actions}" -- "${cur}") )
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${actions}" -- "${cur}"))
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
@ -228,9 +226,11 @@ brainy() {
|
|||
typeset func
|
||||
case $action in
|
||||
show)
|
||||
func=__brainy_show;;
|
||||
func=__brainy_show
|
||||
;;
|
||||
hide)
|
||||
func=__brainy_hide;;
|
||||
func=__brainy_hide
|
||||
;;
|
||||
esac
|
||||
for seg in ${segs}; do
|
||||
seg=$(printf "%s" "${seg}" | tr '[:lower:]' '[:upper:]')
|
||||
|
|
@ -292,10 +292,10 @@ __brainy_ps2() {
|
|||
}
|
||||
|
||||
_brainy_prompt() {
|
||||
exitcode="$?"
|
||||
exitcode="$?"
|
||||
|
||||
PS1="$(__brainy_ps1)"
|
||||
PS2="$(__brainy_ps2)"
|
||||
PS1="$(__brainy_ps1)"
|
||||
PS2="$(__brainy_ps2)"
|
||||
}
|
||||
|
||||
safe_append_prompt_command _brainy_prompt
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX=""
|
||||
SCM_THEME_PROMPT_SUFFIX=""
|
||||
|
|
@ -10,16 +10,14 @@ SCM_SVN_CHAR="${bold_cyan}⑆${normal}"
|
|||
SCM_HG_CHAR="${bold_red}☿${normal}"
|
||||
|
||||
is_vim_shell() {
|
||||
if [ ! -z "$VIMRUNTIME" ]
|
||||
then
|
||||
if [ -n "$VIMRUNTIME" ]; then
|
||||
echo "[${cyan}vim shell${normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
scm_prompt() {
|
||||
CHAR=$(scm_char)
|
||||
if [ $CHAR = $SCM_NONE_CHAR ]
|
||||
then
|
||||
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
|
||||
return
|
||||
else
|
||||
echo " $(scm_char) (${white}$(scm_prompt_info)${normal})"
|
||||
|
|
@ -27,7 +25,7 @@ scm_prompt() {
|
|||
}
|
||||
|
||||
prompt() {
|
||||
PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h $(clock_prompt) ${reset_color}${normal} $(battery_charge)\n${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell)\n${white}>${normal} "
|
||||
PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h $(clock_prompt) ${reset_color}${normal} $(battery_charge)\n${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell)\n${white}>${normal} "
|
||||
}
|
||||
|
||||
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue$background_white"}
|
||||
|
|
|
|||
|
|
@ -9,48 +9,50 @@ SCM_HG_CHAR="${bold_red}☿${normal}"
|
|||
|
||||
case $TERM in
|
||||
xterm*)
|
||||
TITLEBAR="\[\033]0;\w\007\]"
|
||||
;;
|
||||
TITLEBAR="\[\033]0;\w\007\]"
|
||||
;;
|
||||
*)
|
||||
TITLEBAR=""
|
||||
;;
|
||||
TITLEBAR=""
|
||||
;;
|
||||
esac
|
||||
|
||||
PS3=">> "
|
||||
|
||||
is_vim_shell() {
|
||||
if [ ! -z "$VIMRUNTIME" ]
|
||||
then
|
||||
if [ ! -z "$VIMRUNTIME" ]; then
|
||||
echo "[${cyan}vim shell${normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
modern_scm_prompt() {
|
||||
CHAR=$(scm_char)
|
||||
if [ $CHAR = $SCM_NONE_CHAR ]
|
||||
then
|
||||
if [ $CHAR = $SCM_NONE_CHAR ]; then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)][$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
prompt() {
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
# Yes, the indenting on these is weird, but it has to be like
|
||||
# this otherwise it won't display properly.
|
||||
|
||||
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell)
|
||||
${bold_red}└─▪${normal} "
|
||||
else
|
||||
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell)
|
||||
└─▪ "
|
||||
detect_venv() {
|
||||
python_venv=""
|
||||
# Detect python venv
|
||||
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
|
||||
python_venv="($PYTHON_VENV_CHAR${CONDA_DEFAULT_ENV}) "
|
||||
elif [[ -n "${VIRTUAL_ENV}" ]]; then
|
||||
python_venv="($PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}")) "
|
||||
fi
|
||||
}
|
||||
|
||||
prompt() {
|
||||
if [ $? -ne 0 ]; then
|
||||
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n${bold_red}└─▪${normal} "
|
||||
else
|
||||
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n└─▪ "
|
||||
fi
|
||||
detect_venv
|
||||
PS1+="${python_venv}${dir_color}"
|
||||
}
|
||||
|
||||
PS2="└─▪ "
|
||||
|
||||
|
||||
|
||||
safe_append_prompt_command prompt
|
||||
|
|
|
|||
Loading…
Reference in New Issue