diff --git a/clean_files.txt b/clean_files.txt index 8bfc2b0e7c..e3100b91e3 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -25,6 +25,7 @@ plugins/ scripts/ template/ test/ +themes/ # root files # @@ -35,60 +36,6 @@ install.sh lint_clean_files.sh uninstall.sh -# themes -# -themes/90210 -themes/agnoster -themes/atomic -themes/axin -themes/bakke -themes/barbuk -themes/binaryanomaly -themes/bira -themes/bobby -themes/bobby-python -themes/brainy -themes/brunton -themes/candy -themes/clean -themes/codeword -themes/cooperkid -themes/cupcake -themes/demula -themes/dos -themes/doubletime -themes/doubletime_multiline -themes/doubletime_multiline_pyonly -themes/dulcie -themes/duru -themes/easy -themes/elixr -themes/emperor -themes/envy -themes/essential -themes/font -themes/gallifrey -themes/gitline -themes/hawaii50 -themes/inretio -themes/iterate -themes/kitsune -themes/lambda -themes/liquidprompt -themes/luan -themes/modern -themes/norbu -themes/oh-my-posh -themes/p4helpers.theme.bash -themes/pete -themes/powerline -themes/powerline-multiline -themes/powerline-naked -themes/pure -themes/purity -themes/rjorgenson -themes/robbyrussell - # vendor init files # vendor/.gitattributes diff --git a/themes/atomic/atomic.theme.bash b/themes/atomic/atomic.theme.bash index c59dbdc9b2..ba5410e098 100644 --- a/themes/atomic/atomic.theme.bash +++ b/themes/atomic/atomic.theme.bash @@ -118,7 +118,7 @@ function ___atomic_prompt_user_info() { function ___atomic_prompt_dir() { local color="${IRed?}" - local box="[|]${normal}" + local box="[|]${normal?}" local info="\w" printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white?}" "${box}" } @@ -276,8 +276,8 @@ RBFU_THEME_PROMPT_SUFFIX="" RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" : "${THEME_SHOW_SUDO:="true"}" : "${THEME_SHOW_SCM:="true"}" diff --git a/themes/axin/axin.theme.bash b/themes/axin/axin.theme.bash index 7e90aded31..31cbf9a958 100644 --- a/themes/axin/axin.theme.bash +++ b/themes/axin/axin.theme.bash @@ -33,6 +33,6 @@ function prompt_command() { PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]@ \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\[$SCM_THEME_PROMPT_PREFIX\]$(clock_prompt) \[$PURPLE\]$(scm_prompt_info) \n\$ \[$RESET\]" } -THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"${white}"} +THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"${white?}"} safe_append_prompt_command prompt_command diff --git a/themes/bakke/bakke.theme.bash b/themes/bakke/bakke.theme.bash index a3670b070f..7840787bca 100644 --- a/themes/bakke/bakke.theme.bash +++ b/themes/bakke/bakke.theme.bash @@ -15,9 +15,9 @@ 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="${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?} " local virtualenv_prompt scm_prompt_info virtualenv_prompt="$(virtualenv_prompt)" scm_prompt_info="$(scm_prompt_info)" diff --git a/themes/barbuk/barbuk.theme.bash b/themes/barbuk/barbuk.theme.bash index 46b37e2b7e..69957bc730 100644 --- a/themes/barbuk/barbuk.theme.bash +++ b/themes/barbuk/barbuk.theme.bash @@ -88,7 +88,7 @@ function __exit_prompt() { if [[ "$exit_code" -ne 0 ]]; then echo "${purple?}${EXIT_CODE_ICON}${yellow?}${exit_code}${bold_orange?} " else - echo "${bold_green}" + echo "${bold_green?}" fi } @@ -168,7 +168,7 @@ function __path_prompt() { dir_color=${red?} fi - echo "${dir_color}\w${normal} " + echo "${dir_color}\w${normal?} " } function __scm_prompt() { @@ -197,7 +197,7 @@ function __prompt-command() { wrap_char="\n" fi - PS1="${PS1}${wrap_char}❯${normal} " + PS1="${PS1}${wrap_char}❯${normal?} " } safe_append_prompt_command __prompt-command diff --git a/themes/binaryanomaly/binaryanomaly.theme.bash b/themes/binaryanomaly/binaryanomaly.theme.bash index 3501e8d469..dacc8c93eb 100644 --- a/themes/binaryanomaly/binaryanomaly.theme.bash +++ b/themes/binaryanomaly/binaryanomaly.theme.bash @@ -58,17 +58,17 @@ function prompt_command() { ps_reboot="${bright_yellow?}${show_reboot_required}${normal?}\n" set_user_color="$(set_user_color)" - ps_username="${set_user_color}\u${normal}" - ps_uh_separator="${dark_grey?}@${normal}" + ps_username="${set_user_color}\u${normal?}" + ps_uh_separator="${dark_grey?}@${normal?}" set_host_color="$(set_host_color)" - ps_hostname="${set_host_color}\h${normal}" + ps_hostname="${set_host_color}\h${normal?}" - ps_path="${yellow?}\w${normal}" + ps_path="${yellow?}\w${normal?}" scm_prompt="$(scm_prompt)" 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 ps_time="$(__ps_time)" diff --git a/themes/brainy/brainy.theme.bash b/themes/brainy/brainy.theme.bash index b93c768f56..1a1570ac3f 100644 --- a/themes/brainy/brainy.theme.bash +++ b/themes/brainy/brainy.theme.bash @@ -90,59 +90,59 @@ ____brainy_bottom() { ############## ___brainy_prompt_user_info() { - color=$bold_blue + color=${bold_blue?} if [ "${THEME_SHOW_SUDO}" == "true" ]; then if sudo -vn 1> /dev/null 2>&1; then - color=$bold_red + color=${bold_red?} fi fi box="[|]" info="\u@\H" if [ -n "${SSH_CLIENT}" ]; then - printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white?}" "${box}" else printf "%s|%s" "${color}" "${info}" fi } ___brainy_prompt_dir() { - color=$bold_yellow + color=${bold_yellow?} box="[|]" info="\w" - printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white?}" "${box}" } ___brainy_prompt_scm() { [ "${THEME_SHOW_SCM}" != "true" ] && return - color=$bold_green + color=${bold_green?} box="$(scm_char) " info="$(scm_prompt_info)" - printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white?}" "${box}" } ___brainy_prompt_python() { [ "${THEME_SHOW_PYTHON}" != "true" ] && return - color=$bold_yellow + color=${bold_yellow?} box="[|]" info="$(python_version_prompt)" - printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_blue}" "${box}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_blue?}" "${box}" } ___brainy_prompt_ruby() { [ "${THEME_SHOW_RUBY}" != "true" ] && return - color=$bold_white + color=${bold_white?} box="[|]" info="rb-$(ruby_version_prompt)" - printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_red}" "${box}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_red?}" "${box}" } ___brainy_prompt_todo() { [ "${THEME_SHOW_TODO}" != "true" ] \ || [ -z "$(which todo.sh)" ] && return - color=$bold_white + color=${bold_white?} box="[|]" 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}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_green?}" "${box}" } ___brainy_prompt_clock() { @@ -150,7 +150,7 @@ ___brainy_prompt_clock() { color=$THEME_CLOCK_COLOR box="[|]" info="$(date +"${THEME_CLOCK_FORMAT}")" - printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_purple}" "${box}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_purple?}" "${box}" } ___brainy_prompt_battery() { @@ -159,28 +159,28 @@ ___brainy_prompt_battery() { || [ "$(battery_percentage)" = "no" ] && return info=$(battery_percentage) - color=$bold_green + color=${bold_green?} if [ "$info" -lt 50 ]; then - color=$bold_yellow + color=${bold_yellow?} elif [ "$info" -lt 25 ]; then - color=$bold_red + color=${bold_red?} fi box="[|]" ac_adapter_connected && charging="+" ac_adapter_disconnected && charging="-" info+="$charging" [ "$info" == "100+" ] && info="AC" - printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}" + printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white?}" "${box}" } ___brainy_prompt_exitcode() { [ "${THEME_SHOW_EXITCODE}" != "true" ] && return - color=$bold_purple + color=${bold_purple?} [ "$exitcode" -ne 0 ] && printf "%s|%s" "${color}" "${exitcode}" } ___brainy_prompt_char() { - color=$bold_white + color=${bold_white?} prompt_char="${__BRAINY_PROMPT_CHAR_PS1}" printf "%s|%s" "${color}" "${prompt_char}" } @@ -258,8 +258,8 @@ export RVM_THEME_PROMPT_SUFFIX="" export VIRTUALENV_THEME_PROMPT_PREFIX="" export VIRTUALENV_THEME_PROMPT_SUFFIX="" -export SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -export SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +export SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +export SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" THEME_SHOW_SUDO=${THEME_SHOW_SUDO:-"true"} THEME_SHOW_SCM=${THEME_SHOW_SCM:-"true"} @@ -270,7 +270,7 @@ THEME_SHOW_TODO=${THEME_SHOW_TODO:-"false"} THEME_SHOW_BATTERY=${THEME_SHOW_BATTERY:-"false"} THEME_SHOW_EXITCODE=${THEME_SHOW_EXITCODE:-"true"} -THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$bold_white"} +THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"${bold_white?}"} THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H:%M:%S"} __BRAINY_PROMPT_CHAR_PS1=${THEME_PROMPT_CHAR_PS1:-">"} @@ -285,12 +285,12 @@ ___BRAINY_BOTTOM=${___BRAINY_BOTTOM:-"exitcode char"} ############ __brainy_ps1() { - printf "%s%s%s" "$(____brainy_top)" "$(____brainy_bottom)" "${normal}" + printf "%s%s%s" "$(____brainy_top)" "$(____brainy_bottom)" "${normal?}" } __brainy_ps2() { - color=$bold_white - printf "%s%s%s" "${color}" "${__BRAINY_PROMPT_CHAR_PS2} " "${normal}" + color=${bold_white?} + printf "%s%s%s" "${color}" "${__BRAINY_PROMPT_CHAR_PS2} " "${normal?}" } _brainy_prompt() { diff --git a/themes/clean/clean.theme.bash b/themes/clean/clean.theme.bash index 47a436b34d..55558219b9 100644 --- a/themes/clean/clean.theme.bash +++ b/themes/clean/clean.theme.bash @@ -12,13 +12,14 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' function prompt_command() { + local no_color if [ "$(whoami)" = root ]; then no_color=${red?} else no_color=${white?} fi - PS1="${no_color}\u${reset_color}:${blue?}\W/${reset_color} $(scm_prompt_info)${normal?}$ " + PS1="${no_color}\u${reset_color?}:${blue?}\W/${reset_color?} $(scm_prompt_info)${normal?}$ " } safe_append_prompt_command prompt_command diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index e60711aaf0..62881d2334 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -3,38 +3,38 @@ SCM_THEME_PROMPT_DIRTY='' SCM_THEME_PROMPT_CLEAN='' -SCM_GIT_CHAR="${bold_cyan}±${normal}" -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_GIT_CHAR="${bold_cyan?}±${normal?}" +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" if [[ -n "$RVM_THEME_PROMPT_COLOR" ]]; then RVM_THEME_PROMPT_COLOR=$(eval "echo $$(echo ${RVM_THEME_PROMPT_COLOR})") else - RVM_THEME_PROMPT_COLOR="${red}" + RVM_THEME_PROMPT_COLOR="${red?}" fi -RVM_THEME_PROMPT_PREFIX="(${RVM_THEME_PROMPT_COLOR}rb${normal}: " +RVM_THEME_PROMPT_PREFIX="(${RVM_THEME_PROMPT_COLOR}rb${normal?}: " RVM_THEME_PROMPT_SUFFIX=") " if [[ -n "$VIRTUALENV_THEME_PROMPT_COLOR" ]]; then VIRTUALENV_THEME_PROMPT_COLOR=$(eval "echo $$(echo ${VIRTUALENV_THEME_PROMPT_COLOR})") else - VIRTUALENV_THEME_PROMPT_COLOR="${green}" + VIRTUALENV_THEME_PROMPT_COLOR="${green?}" fi -VIRTUALENV_THEME_PROMPT_PREFIX="(${VIRTUALENV_THEME_PROMPT_COLOR}py${normal}: " +VIRTUALENV_THEME_PROMPT_PREFIX="(${VIRTUALENV_THEME_PROMPT_COLOR}py${normal?}: " VIRTUALENV_THEME_PROMPT_SUFFIX=") " if [[ -n "$THEME_PROMPT_HOST_COLOR" ]]; then THEME_PROMPT_HOST_COLOR=$(eval "echo $$(echo ${THEME_PROMPT_HOST_COLOR})") else - THEME_PROMPT_HOST_COLOR="$blue" + THEME_PROMPT_HOST_COLOR="${blue?}" fi function prompt_setter() { # Save history _save-and-reload-history 1 PS1=" -$(clock_prompt) $(scm_char) [${THEME_PROMPT_HOST_COLOR}\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w -$(scm_prompt)$reset_color $ " +$(clock_prompt) $(scm_char) [${THEME_PROMPT_HOST_COLOR}\u@${THEME_PROMPT_HOST}${reset_color?}] $(virtualenv_prompt)$(ruby_version_prompt)\w +$(scm_prompt)${reset_color?} $ " PS2='> ' PS4='+ ' } diff --git a/themes/doubletime_multiline/doubletime_multiline.theme.bash b/themes/doubletime_multiline/doubletime_multiline.theme.bash index 32e789ea5f..366010436c 100644 --- a/themes/doubletime_multiline/doubletime_multiline.theme.bash +++ b/themes/doubletime_multiline/doubletime_multiline.theme.bash @@ -9,7 +9,7 @@ function prompt_setter() { PS1=" $(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}${reset_color?}] $(virtualenv_prompt)$(ruby_version_prompt) \w -$(scm_prompt)$reset_color $ " +$(scm_prompt)${reset_color?} $ " PS2='> ' PS4='+ ' } diff --git a/themes/doubletime_multiline_pyonly/doubletime_multiline_pyonly.theme.bash b/themes/doubletime_multiline_pyonly/doubletime_multiline_pyonly.theme.bash index aa078e788d..2729e7989f 100644 --- a/themes/doubletime_multiline_pyonly/doubletime_multiline_pyonly.theme.bash +++ b/themes/doubletime_multiline_pyonly/doubletime_multiline_pyonly.theme.bash @@ -9,7 +9,7 @@ function prompt_setter() { PS1=" $(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}${reset_color?}] $(virtualenv_prompt) \w -$(scm_prompt)$reset_color $ " +$(scm_prompt)${reset_color?} $ " PS2='> ' PS4='+ ' } diff --git a/themes/dulcie/dulcie.theme.bash b/themes/dulcie/dulcie.theme.bash index be08940344..27e5a19190 100644 --- a/themes/dulcie/dulcie.theme.bash +++ b/themes/dulcie/dulcie.theme.bash @@ -54,11 +54,11 @@ dulcie_prompt() { DULCIE_WORKINGDIR="${color_workingdir?}\W${reset_color?}" DULCIE_PROMPTCHAR="${color_user?}"'\$'"${reset_color?}" - SCM_THEME_PROMPT_DIRTY=" ${red?}✗${reset_color}" + SCM_THEME_PROMPT_DIRTY=" ${red?}✗${reset_color?}" SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" DULCIE_SCM_BACKGROUND="${background_scm}" DULCIE_SCM_DIR_COLOR="${color_rootdir}" - SCM_THEME_ROOT_SUFFIX="${reset_color}${SCM_THEME_ROOT_SUFFIX}" + SCM_THEME_ROOT_SUFFIX="${reset_color?}${SCM_THEME_ROOT_SUFFIX}" SCM_THEME_PROMPT_DIRTY=" $(dulcie_color 1)✗${reset_color?}" SCM_THEME_PROMPT_CLEAN=" $(dulcie_color 10)✓${reset_color?}" else @@ -80,17 +80,17 @@ dulcie_prompt() { # Open the new terminal in the same directory _is_function __vte_osc7 && __vte_osc7 - PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color?} ${DULCIE_WORKINGDIR}]" + PS1="${reset_color?}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color?} ${DULCIE_WORKINGDIR}]" if [[ "${DULCIE_MULTILINE}" -eq "1" ]]; then - PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}${reset_color?} ${DULCIE_WORKINGDIR}]" + PS1="${reset_color?}[${DULCIE_USER}@${DULCIE_HOST}${reset_color?} ${DULCIE_WORKINGDIR}]" if [[ "$(scm_prompt_info)" ]]; then SCM_THEME_PROMPT_PREFIX="${DULCIE_SCM_BACKGROUND}|${DULCIE_SCM_DIR_COLOR}" - SCM_THEME_PROMPT_SUFFIX="|${normal}" + SCM_THEME_PROMPT_SUFFIX="|${normal?}" PS1="$(scm_prompt_info)\n${PS1}" fi else SCM_THEME_PROMPT_PREFIX=" ${DULCIE_SCM_BACKGROUND}|${DULCIE_SCM_DIR_COLOR}" - SCM_THEME_PROMPT_SUFFIX="|${normal}" + SCM_THEME_PROMPT_SUFFIX="|${normal?}" PS1="${reset_color?}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color?} ${DULCIE_WORKINGDIR}]" fi PS1="${PS1}${DULCIE_PROMPTCHAR} " diff --git a/themes/elixr/elixr.theme.bash b/themes/elixr/elixr.theme.bash index d266fae89d..62dd435554 100644 --- a/themes/elixr/elixr.theme.bash +++ b/themes/elixr/elixr.theme.bash @@ -18,7 +18,7 @@ RVM_THEME_PROMPT_SUFFIX=" d|" BOLD="\[\e[1m\]" function prompt_command() { - PS1="\n${bold_cyan?}$(scm_prompt_char_info)$(virtualenv_prompt) ${bold_cyan}\w :${reset_color?}${normal?}${BOLD} " + PS1="\n${bold_cyan?}$(scm_prompt_char_info)$(virtualenv_prompt) ${bold_cyan?}\w :${reset_color?}${normal?}${BOLD} " } safe_append_prompt_command prompt_command diff --git a/themes/inretio/inretio.theme.bash b/themes/inretio/inretio.theme.bash index 1db6c6d1f4..9f640bf8af 100644 --- a/themes/inretio/inretio.theme.bash +++ b/themes/inretio/inretio.theme.bash @@ -84,15 +84,15 @@ _theme_clock() { fi } THEME_SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"false"} -THEME_CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"$red"} -THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$normal"} +THEME_CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"${red?}"} +THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"${normal?}"} THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%Y-%m-%d %H:%M:%S"} # PROMPT OUTPUT =============================================================== # Displays the current prompt function prompt_command() { - PS1="\n${icon_start}$(_theme_clock)${icon_user}${bold_green?}\u${normal}${icon_host}${bold_cyan?}\h${normal}${green?}$(_virtualenv_prompt)${normal}${icon_directory}${bold_purple?}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} $(scm_prompt_info) \")${white?}${normal}\n${icon_end}" + PS1="\n${icon_start}$(_theme_clock)${icon_user}${bold_green?}\u${normal?}${icon_host}${bold_cyan?}\h${normal?}${green?}$(_virtualenv_prompt)${normal?}${icon_directory}${bold_purple?}\W${normal?}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} $(scm_prompt_info) \")${white?}${normal}\n${icon_end}" PS2="${icon_end}" } diff --git a/themes/lambda/lambda.theme.bash b/themes/lambda/lambda.theme.bash index 59f82a4a81..20d118e297 100644 --- a/themes/lambda/lambda.theme.bash +++ b/themes/lambda/lambda.theme.bash @@ -23,13 +23,13 @@ function set_prompt { PS1+="${dir_color} \\w" # current working directory # Git information (status symbol) - PS1+=" ${git_color}$(__git_ps1 "[%s]")${reset_color}" + PS1+=" ${git_color}$(__git_ps1 "[%s]")${reset_color?}" if [ $time_taken -gt 0 ]; then PS1+=" ${time_color}took ${time_taken}ms" # time taken in milliseconds fi - PS1+="\n${prompt_symbol_color}╰─λ${reset_color} " # red color for the prompt symbol, reset color after + PS1+="\n${prompt_symbol_color}╰─λ${reset_color?} " # red color for the prompt symbol, reset color after } PROMPT_COMMAND='start_time=$(date +%s%3N); set_prompt' diff --git a/themes/mairan/mairan.theme.bash b/themes/mairan/mairan.theme.bash index 65ef7ac1d3..66c526913c 100644 --- a/themes/mairan/mairan.theme.bash +++ b/themes/mairan/mairan.theme.bash @@ -1,3 +1,6 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # Mairan Bash Prompt, inspired by "Zork" if tput setaf 1 &> /dev/null; then @@ -34,11 +37,11 @@ BRACKET_COLOR=$ORANGE SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" -SCM_GIT_CHAR="${bold_green}±${normal}" -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" +SCM_GIT_CHAR="${bold_green?}±${normal?}" +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" #Mysql Prompt export MYSQL_PS1="(\u@\h) [\d]> " @@ -55,58 +58,61 @@ esac PS3=">> " __my_rvm_ruby_version() { - local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') - [ "$gemset" != "" ] && gemset="@$gemset" - local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') - local full="$version$gemset" - [ "$full" != "" ] && echo "[$full]" + local version gemset + gemset=$(echo "${GEM_HOME}" | awk -F'@' '{print $2}') + [[ -n "${gemset}" ]] && gemset="@${gemset}" + version=$(echo "${MY_RUBY_HOME}" | awk -F'-' '{print $2}') + local full="${version}${gemset}" + [[ -n "${full}" ]] && echo "[${full}]" } is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ]; then - echo "[${cyan}vim shell${normal}]" + if [[ -n "$VIMRUNTIME" ]]; then + echo "[${cyan?}vim shell${normal?}]" fi } # show chroot if exist chroot() { - if [ -n "$debian_chroot" ]; then - my_ps_chroot="${bold_cyan}$debian_chroot${normal}" + if [[ -n "$debian_chroot" ]]; then + my_ps_chroot="${bold_cyan?}$debian_chroot${normal?}" echo "($my_ps_chroot)" fi } # show virtualenvwrapper my_ve() { - if [ -n "$VIRTUAL_ENV" ]; then - my_ps_ve="${bold_purple}$ve${normal}" + if [[ -n "$VIRTUAL_ENV" ]]; then + my_ps_ve="${bold_purple?}$ve${normal?}" echo "($my_ps_ve)" fi echo "" } prompt() { - SCM_PROMPT_FORMAT="[%s$GREEN%s]" - my_ps_host="$BOLD$ORANGE\h${normal}" + SCM_PROMPT_FORMAT="[%s${GREEN}%s]" + my_ps_host="${BOLD}${ORANGE}\h${normal?}" # yes, these are the the same for now ... - my_ps_host_root="$ORANGE\h${normal}" + my_ps_host_root="${ORANGE}\h${normal?}" - my_ps_user="$BOLD$GREEN\u${normal}" - my_ps_root="${bold_red}\u${normal}" + my_ps_user="${BOLD}${GREEN}\u${normal?}" + my_ps_root="${bold_red?}\u${normal?}" - if [ -n "$VIRTUAL_ENV" ]; then - ve=$(basename "$VIRTUAL_ENV") + if [[ -n "$VIRTUAL_ENV" ]]; then + ve=$(basename "${VIRTUAL_ENV}") fi # nice prompt case "$(id -u)" in 0) - PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR} -└─▪ ${prompt_symbol} ${normal}" + # shellcheck disable=SC2312 + PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal?}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${green?}\w${normal?}]$(is_vim_shell)${BRACKET_COLOR} +└─▪ ${prompt_symbol} ${normal?}" ;; *) - PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)${normal}$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR} -└─▪ ${prompt_symbol} ${normal}" + # shellcheck disable=SC2312 + PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal?}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)${normal?}$(__my_rvm_ruby_version)[${green?}\w${normal?}]$(is_vim_shell)${BRACKET_COLOR} +└─▪ ${prompt_symbol} ${normal?}" ;; esac } diff --git a/themes/mbriggs/mbriggs.theme.bash b/themes/mbriggs/mbriggs.theme.bash index 9e1511e316..d6071d93c2 100644 --- a/themes/mbriggs/mbriggs.theme.bash +++ b/themes/mbriggs/mbriggs.theme.bash @@ -1,16 +1,19 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # ------------------------------------------------------------------# # FILE: mbriggs.zsh-theme # # BY: Matt Briggs (matt@mattbriggs.net) # # BASED ON: smt by Stephen Tudor (stephen@tudorstudio.com) # # ------------------------------------------------------------------# -SCM_THEME_PROMPT_DIRTY="${red}⚡${reset_color}" -SCM_THEME_PROMPT_AHEAD="${red}!${reset_color}" -SCM_THEME_PROMPT_CLEAN="${green}✓${reset_color}" +SCM_THEME_PROMPT_DIRTY="${red?}⚡${reset_color?}" +SCM_THEME_PROMPT_AHEAD="${red?}!${reset_color?}" +SCM_THEME_PROMPT_CLEAN="${green?}✓${reset_color?}" SCM_THEME_PROMPT_PREFIX=" " SCM_THEME_PROMPT_SUFFIX="" -GIT_SHA_PREFIX=" ${yellow}" -GIT_SHA_SUFFIX="${reset_color}" +GIT_SHA_PREFIX=" ${yellow?}" +GIT_SHA_SUFFIX="${reset_color?}" function git_short_sha() { SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX" @@ -18,11 +21,13 @@ function git_short_sha() { function prompt() { local return_status="" - local ruby="${red}$(ruby_version_prompt)${reset_color}" - local user_host="${green}\h${reset_color}" + local ruby + ruby="${red?}$(ruby_version_prompt)${reset_color?}" + local user_host="${green?}\h${reset_color?}" local current_path="\w" local n_commands="\!" - local git_branch="$(git_short_sha)$(scm_prompt_info)" + local git_branch + git_branch="$(git_short_sha)$(scm_prompt_info)" local prompt_symbol='λ' local open='(' local close=')' diff --git a/themes/metal/metal.theme.bash b/themes/metal/metal.theme.bash index e68a90a9b7..676bb497c1 100644 --- a/themes/metal/metal.theme.bash +++ b/themes/metal/metal.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. # Emoji-based theme to display source control management and # virtual environment info beside the ordinary bash prompt. @@ -21,11 +22,11 @@ VIRTUALENV_THEME_PROMPT_SUFFIX="" # SCM prompts SCM_NONE_CHAR="" SCM_GIT_CHAR="[±] " -SCM_GIT_BEHIND_CHAR="${red}↓${normal}" -SCM_GIT_AHEAD_CHAR="${bold_green}↑${normal}" +SCM_GIT_BEHIND_CHAR="${red?}↓${normal?}" +SCM_GIT_AHEAD_CHAR="${bold_green?}↑${normal?}" SCM_GIT_UNTRACKED_CHAR="⌀" -SCM_GIT_UNSTAGED_CHAR="${bold_yellow}•${normal}" -SCM_GIT_STAGED_CHAR="${bold_green}+${normal}" +SCM_GIT_UNSTAGED_CHAR="${bold_yellow?}•${normal?}" +SCM_GIT_STAGED_CHAR="${bold_green?}+${normal?}" SCM_THEME_PROMPT_DIRTY="" SCM_THEME_PROMPT_CLEAN="" @@ -33,8 +34,8 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" # Git status prompts -GIT_THEME_PROMPT_DIRTY=" ${red}✗${normal}" -GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +GIT_THEME_PROMPT_DIRTY=" ${red?}✗${normal?}" +GIT_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" GIT_THEME_PROMPT_PREFIX="" GIT_THEME_PROMPT_SUFFIX="" @@ -61,11 +62,13 @@ function virtualenv_prompt { # Rename tab function tabname { + # shellcheck disable=SC2059 printf "\e]1;$1\a" } # Rename window function winname { + # shellcheck disable=SC2059 printf "\e]2;$1\a" } @@ -73,7 +76,7 @@ function winname { # Displays the current prompt function prompt_command() { - PS1="\n${icon_start}$(virtualenv_prompt)${icon_user}${bold_green}\u${normal}${icon_host}${bold_cyan}\h${normal}${icon_directory}${bold_purple}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${white}$(scm_prompt_info)${normal}\n${icon_end}" + PS1="\n${icon_start}$(virtualenv_prompt)${icon_user}${bold_green?}\u${normal?}${icon_host}${bold_cyan?}\h${normal?}${icon_directory}${bold_purple?}\W${normal?}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${white?}$(scm_prompt_info)${normal?}\n${icon_end}" PS2="${icon_end}" } diff --git a/themes/minimal/minimal.theme.bash b/themes/minimal/minimal.theme.bash index 2bf807c16f..52490735f4 100644 --- a/themes/minimal/minimal.theme.bash +++ b/themes/minimal/minimal.theme.bash @@ -1,12 +1,13 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. -SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" -SCM_THEME_PROMPT_SUFFIX="${cyan})" -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" +SCM_THEME_PROMPT_PREFIX="${cyan?}(${green?}" +SCM_THEME_PROMPT_SUFFIX="${cyan?})" +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${green?}✓" prompt() { - PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " + PS1="$(scm_prompt_info)${reset_color?} ${cyan?}\W${reset_color?} " } safe_append_prompt_command prompt diff --git a/themes/modern-t/modern-t.theme.bash b/themes/modern-t/modern-t.theme.bash index c0a5b556e7..eed15a94de 100644 --- a/themes/modern-t/modern-t.theme.bash +++ b/themes/modern-t/modern-t.theme.bash @@ -1,3 +1,6 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # The "modern-t" theme is a "modern" theme variant with support # for "t", the minimalist python todo list utility by Steve Losh. # Get and install "t" at https://github.com/sjl/t#installing-t @@ -8,11 +11,11 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" -SCM_GIT_CHAR="${bold_green}±${normal}" -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" +SCM_GIT_CHAR="${bold_green?}±${normal?}" +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" case $TERM in xterm*) @@ -27,20 +30,21 @@ PS3=">> " is_vim_shell() { if [ ! -z "$VIMRUNTIME" ]; then - echo "[${cyan}vim shell${normal}]" + echo "[${cyan?}vim shell${normal?}]" fi } prompt() { SCM_PROMPT_FORMAT='[%s][%s]' - if [ $? -ne 0 ]; then + # shellcheck disable=SC2181 # How can this assignment fail? an immutable VAR name? + 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}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) -${bold_red}└─▪${normal} " + PS1="${TITLEBAR}${bold_red?}┌─[${cyan?}$(t | wc -l | sed -e's/ *//')${reset_color?}]${reset_color?}$(scm_prompt)[${cyan?}\W${normal?}]$(is_vim_shell) +${bold_red?}└─▪${normal?} " else - PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) + PS1="${TITLEBAR}┌─[${cyan?}$(t | wc -l | sed -e's/ *//')${reset_color?}]$(scm_prompt)[${cyan?}\W${normal?}]$(is_vim_shell) └─▪ " fi } diff --git a/themes/modern-time/modern-time.theme.bash b/themes/modern-time/modern-time.theme.bash index ceb2f5ede3..2ae39552ee 100644 --- a/themes/modern-time/modern-time.theme.bash +++ b/themes/modern-time/modern-time.theme.bash @@ -1,16 +1,19 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # Modified version of the original modern theme in bash-it # Removes the battery charge and adds the current time SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" -SCM_GIT_CHAR="${bold_green}±${normal}" -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" +SCM_GIT_CHAR="${bold_green?}±${normal?}" +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" -case $TERM in +case ${TERM} in xterm*) TITLEBAR="\[\033]0;\w\007\]" ;; @@ -22,8 +25,8 @@ esac PS3=">> " is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ]; then - echo "[${cyan}vim shell${normal}]" + if [[ -n "$VIMRUNTIME" ]]; then + echo "[${cyan?}vim shell${normal?}]" fi } @@ -32,15 +35,16 @@ modern_current_time_prompt() { } prompt() { - SCM_PROMPT_FORMAT='[%s][%s]' if [ $? -ne 0 ]; then + SCM_PROMPT_FORMAT='[%s][%s]' # 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}$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell) -${bold_red}└─▪${normal} " + PS1="${TITLEBAR}${bold_red?}┌─${reset_color?}$(scm_prompt)$(modern_current_time_prompt)[${cyan?}\W${normal?}]$(is_vim_shell) +${bold_red?}└─▪${normal?} " else - PS1="${TITLEBAR}┌─$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell) + SCM_PROMPT_FORMAT='[%s][%s]' + PS1="${TITLEBAR}┌─$(scm_prompt)$(modern_current_time_prompt)[${cyan?}\W${normal?}]$(is_vim_shell) └─▪ " fi } diff --git a/themes/morris/morris.theme.bash b/themes/morris/morris.theme.bash index 58b1bad816..d23eea63e4 100644 --- a/themes/morris/morris.theme.bash +++ b/themes/morris/morris.theme.bash @@ -1,3 +1,6 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # prompt theming # added TITLEBAR for updating the tab and window titles with the pwd @@ -18,9 +21,9 @@ function prompt_command() { } # scm theming -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" -SCM_THEME_PROMPT_PREFIX="${green}(" -SCM_THEME_PROMPT_SUFFIX="${green})${reset_color}" +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓" +SCM_THEME_PROMPT_PREFIX="${green?}(" +SCM_THEME_PROMPT_SUFFIX="${green?})${reset_color?}" safe_append_prompt_command prompt_command diff --git a/themes/n0qorg/n0qorg.theme.bash b/themes/n0qorg/n0qorg.theme.bash index b82a17f3d4..aaf781acde 100644 --- a/themes/n0qorg/n0qorg.theme.bash +++ b/themes/n0qorg/n0qorg.theme.bash @@ -1,4 +1,6 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # n0qorg theme by Florian Baumann ## look-a-like @@ -6,17 +8,17 @@ # for example: # ananas ~/Code/bash-it/themes (master*)» function prompt_command() { - PS1="${bold_blue}[$(hostname)]${normal} \w${normal} ${bold_white}[$(git_prompt_info)]${normal}» " + PS1="${bold_blue?}[$(hostname)]${normal?} \w${normal?} ${bold_white?}[$(git_prompt_info)]${normal?}» " } safe_append_prompt_command prompt_command ## git-theme # feel free to change git chars. -GIT_THEME_PROMPT_DIRTY="${bold_blue}*${bold_white}" +GIT_THEME_PROMPT_DIRTY="${bold_blue?}*${bold_white?}" GIT_THEME_PROMPT_CLEAN="" -GIT_THEME_PROMPT_PREFIX="${bold_blue}(${bold_white}" -GIT_THEME_PROMPT_SUFFIX="${bold_blue})" +GIT_THEME_PROMPT_PREFIX="${bold_blue?}(${bold_white?}" +GIT_THEME_PROMPT_SUFFIX="${bold_blue?})" ## alternate chars # diff --git a/themes/newin/newin.theme.bash b/themes/newin/newin.theme.bash index cabd024fe1..1ceed19008 100644 --- a/themes/newin/newin.theme.bash +++ b/themes/newin/newin.theme.bash @@ -1,13 +1,14 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" -SCM_THEME_PROMPT_PREFIX=" ${purple}|${green} " -SCM_THEME_PROMPT_SUFFIX="${purple} |" +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${green?}✓" +SCM_THEME_PROMPT_PREFIX=" ${purple?}|${green?} " +SCM_THEME_PROMPT_SUFFIX="${purple?} |" prompt() { exit_code=$? - PS1="$(if [[ ${exit_code} = 0 ]]; then echo "${green}${exit_code}"; else echo "${red}${exit_code}"; fi) ${yellow}\t ${cyan}\w$(scm_prompt_info)${reset_color}\n${orange}$ ${reset_color}" + PS1="$(if [[ ${exit_code} = 0 ]]; then echo "${green?}${exit_code}"; else echo "${red?}${exit_code}"; fi) ${yellow?}\t ${cyan?}\w$(scm_prompt_info)${reset_color?}\n${orange?}$ ${reset_color?}" } safe_append_prompt_command prompt diff --git a/themes/nwinkler/nwinkler.theme.bash b/themes/nwinkler/nwinkler.theme.bash index 5bb66aee69..18d6e018cb 100644 --- a/themes/nwinkler/nwinkler.theme.bash +++ b/themes/nwinkler/nwinkler.theme.bash @@ -1,4 +1,5 @@ # shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. # Two line prompt showing the following information: # (time) SCM [username@hostname] pwd (SCM branch SCM status) @@ -15,8 +16,8 @@ # The exit code functionality currently doesn't work if you are using the 'fasd' plugin, # since 'fasd' is messing with the $PROMPT_COMMAND -PROMPT_END_CLEAN="${green}→${reset_color}" -PROMPT_END_DIRTY="${red}→${reset_color}" +PROMPT_END_CLEAN="${green?}→${reset_color?}" +PROMPT_END_DIRTY="${red?}→${reset_color?}" function prompt_end() { echo -e "$PROMPT_END" @@ -31,15 +32,15 @@ prompt_setter() { fi # Save history _save-and-reload-history 1 - PS1="($(clock_prompt)) $(scm_char) [${blue}\u${reset_color}@${green}\H${reset_color}] ${yellow}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) " + PS1="($(clock_prompt)) $(scm_char) [${blue?}\u${reset_color?}@${green?}\H${reset_color?}] ${yellow?}\w${reset_color?}$(scm_prompt_info) ${reset_color?}\n$(prompt_end) " PS2='> ' PS4='+ ' } safe_append_prompt_command prompt_setter -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" SCM_THEME_PROMPT_PREFIX=" (" SCM_THEME_PROMPT_SUFFIX=")" RVM_THEME_PROMPT_PREFIX=" (" diff --git a/themes/nwinkler_random_colors/nwinkler_random_colors.theme.bash b/themes/nwinkler_random_colors/nwinkler_random_colors.theme.bash index c23860a1b4..8862400fd8 100644 --- a/themes/nwinkler_random_colors/nwinkler_random_colors.theme.bash +++ b/themes/nwinkler_random_colors/nwinkler_random_colors.theme.bash @@ -1,4 +1,5 @@ # shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. # Two line prompt showing the following information: # (time) SCM [username@hostname] pwd (SCM branch SCM status) @@ -20,25 +21,26 @@ RANDOM_COLOR_FILE=$HOME/.nwinkler_random_colors function randomize_nwinkler { declare -a AVAILABLE_COLORS + # shellcheck disable=SC2206 # Expected behavior but fine for this theme. AVAILABLE_COLORS=( - $black - $red - $green - $yellow - $blue - $purple - $cyan - $white - $orange - $bold_black - $bold_red - $bold_green - $bold_yellow - $bold_blue - $bold_purple - $bold_cyan - $bold_white - $bold_orange + "${black?}" + "${red?}" + "${green?}" + "${yellow?}" + "${blue?}" + "${purple?}" + "${cyan?}" + "${white?}" + "${orange?}" + "${bold_black?}" + "${bold_red?}" + "${bold_green?}" + "${bold_yellow?}" + "${bold_blue?}" + "${bold_purple?}" + "${bold_cyan?}" + "${bold_white?}" + "${bold_orange?}" ) # Uncomment these to allow underlines: #$underline_black @@ -58,12 +60,12 @@ function randomize_nwinkler { THEME_CLOCK_COLOR=$TIME_COLOR PATH_COLOR=${AVAILABLE_COLORS[$RANDOM % ${#AVAILABLE_COLORS[@]}]} - echo "$USERNAME_COLOR,$HOSTNAME_COLOR,$TIME_COLOR,$PATH_COLOR," > $RANDOM_COLOR_FILE + echo "$USERNAME_COLOR,$HOSTNAME_COLOR,$TIME_COLOR,$PATH_COLOR," > "$RANDOM_COLOR_FILE" } -if [ -f $RANDOM_COLOR_FILE ]; then +if [ -f "$RANDOM_COLOR_FILE" ]; then # read the colors already stored in the file - IFS=',' read -ra COLORS < $RANDOM_COLOR_FILE + IFS=',' read -ra COLORS < "$RANDOM_COLOR_FILE" USERNAME_COLOR=${COLORS[0]} HOSTNAME_COLOR=${COLORS[1]} TIME_COLOR=${COLORS[2]} @@ -82,8 +84,8 @@ else echo fi -PROMPT_END_CLEAN="${green}→${reset_color}" -PROMPT_END_DIRTY="${red}→${reset_color}" +PROMPT_END_CLEAN="${green?}→${reset_color?}" +PROMPT_END_DIRTY="${red?}→${reset_color?}" function prompt_end() { echo -e "$PROMPT_END" @@ -98,15 +100,15 @@ prompt_setter() { fi # Save history _save-and-reload-history 1 - PS1="($(clock_prompt)${reset_color}) $(scm_char) [${USERNAME_COLOR}\u${reset_color}@${HOSTNAME_COLOR}\H${reset_color}] ${PATH_COLOR}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) " + PS1="($(clock_prompt)${reset_color?}) $(scm_char) [${USERNAME_COLOR}\u${reset_color?}@${HOSTNAME_COLOR}\H${reset_color?}] ${PATH_COLOR}\w${reset_color?}$(scm_prompt_info) ${reset_color}\n$(prompt_end) " PS2='> ' PS4='+ ' } safe_append_prompt_command prompt_setter -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" SCM_THEME_PROMPT_PREFIX=" (" SCM_THEME_PROMPT_SUFFIX=")" RVM_THEME_PROMPT_PREFIX=" (" diff --git a/themes/oh-my-posh/oh-my-posh.theme.bash b/themes/oh-my-posh/oh-my-posh.theme.bash index 430c8acb4c..f41615dc6e 100644 --- a/themes/oh-my-posh/oh-my-posh.theme.bash +++ b/themes/oh-my-posh/oh-my-posh.theme.bash @@ -1,4 +1,5 @@ # shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. if _command_exists oh-my-posh; then export POSH_THEME=${POSH_THEME:-https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json} diff --git a/themes/parrot/parrot.theme.bash b/themes/parrot/parrot.theme.bash index 266fe8a683..0afd3522d2 100644 --- a/themes/parrot/parrot.theme.bash +++ b/themes/parrot/parrot.theme.bash @@ -1,3 +1,6 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # git branch parser function parse_git_branch() { echo -e "\[\033[1;34m\]$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')\[\033[0m\]" @@ -25,6 +28,7 @@ function prompt() { fi if [ "$color_prompt" = yes ]; then + # shellcheck disable=SC2028 PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]$(parse_git_branch) $\[\e[0m\] " else diff --git a/themes/powerline-multiline/powerline-multiline.base.bash b/themes/powerline-multiline/powerline-multiline.base.bash index 02bbf39eb8..2d3837172b 100644 --- a/themes/powerline-multiline/powerline-multiline.base.bash +++ b/themes/powerline-multiline/powerline-multiline.base.bash @@ -22,7 +22,7 @@ function __powerline_right_segment() { # Since the previous segment wasn't the last segment, add padding, if needed # if [[ "${POWERLINE_COMPACT_AFTER_SEPARATOR:-0}" -eq 0 ]]; then - RIGHT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR?}") ${normal}" + RIGHT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR?}") ${normal?}" ((padding += 1)) fi if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]:-}" ]]; then diff --git a/themes/powerline-plain/powerline-plain.base.bash b/themes/powerline-plain/powerline-plain.base.bash index c077a089fc..08b81b5fc6 100644 --- a/themes/powerline-plain/powerline-plain.base.bash +++ b/themes/powerline-plain/powerline-plain.base.bash @@ -1,8 +1,12 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + . "$BASH_IT/themes/powerline/powerline.base.bash" function __powerline_left_segment { local OLD_IFS="${IFS}" IFS="|" + # shellcheck disable=SC2206 local params=($1) IFS="${OLD_IFS}" local pad_before_segment=" " @@ -18,11 +22,11 @@ function __powerline_left_segment { # Since the previous segment wasn't the last segment, add padding, if needed # if [[ "${POWERLINE_COMPACT_BEFORE_SEPARATOR}" -eq 0 ]]; then - LEFT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR}) ${normal}" + LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}") ${normal?}" fi fi - LEFT_PROMPT+="$(set_color - ${params[1]})${pad_before_segment}${params[0]}${normal}" + LEFT_PROMPT+="$(set_color - "${params[1]}")${pad_before_segment}${params[0]}${normal?}" LAST_SEGMENT_COLOR=${params[1]} ((SEGMENTS_AT_LEFT += 1)) } @@ -39,11 +43,12 @@ function __powerline_prompt_command { ## left prompt ## for segment in $POWERLINE_PROMPT; do - local info="$(__powerline_${segment}_prompt)" + local info + info="$(__powerline_"${segment}"_prompt)" [[ -n "${info}" ]] && __powerline_left_segment "${info}" done - [[ "${last_status}" -ne 0 ]] && __powerline_left_segment $(__powerline_last_status_prompt ${last_status}) + [[ "${last_status}" -ne 0 ]] && __powerline_left_segment "$(__powerline_last_status_prompt "${last_status}")" if [[ -n "${LEFT_PROMPT}" ]] && [[ "${POWERLINE_COMPACT_AFTER_LAST_SEGMENT}" -eq 0 ]]; then __powerline_left_last_segment_padding diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index 675715287d..0cb0a0e92f 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. . "$BASH_IT/themes/powerline-plain/powerline-plain.base.bash" diff --git a/themes/powerturk/powerturk.theme.bash b/themes/powerturk/powerturk.theme.bash index 85f2d7ae91..01be0f19b2 100644 --- a/themes/powerturk/powerturk.theme.bash +++ b/themes/powerturk/powerturk.theme.bash @@ -1,4 +1,6 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # Power-Turk theme for bash-it # Author (C) 2015 Ahmed Seref Guneysu @@ -30,11 +32,12 @@ LAST_STATUS_THEME_PROMPT_COLOR=52 _collapsed_wd() { # echo -e "\u2771\u276d\u276f" - echo $(pwd | perl -pe " + # shellcheck disable=SC2005 + echo "$(pwd | perl -pe " BEGIN { binmode STDIN, ':encoding(UTF-8)'; binmode STDOUT, ':encoding(UTF-8)'; - }; s|^$HOME||g; s|/([^/])[^/]*(?=/)|/\$1|g") \ + }; s|^$HOME||g; s|/([^/])[^/]*(?=/)|/\$1|g")" \ | sed -re "s/\//  /g" } @@ -45,22 +48,22 @@ _swd() { current="" # The section of the path we're currently working on. end="${2:-${PWD}}/" # The unmodified rest of the path. - if [[ "$end" =~ "$HOME" ]]; then + if [[ "$end" == "$HOME"* ]]; then INHOME=1 - end="${end#$HOME}" #strip /home/username from start of string - begin="$HOME" #start expansion from the right spot + end="${end#"$HOME"}" #strip /home/username from start of string + begin="${HOME}" #start expansion from the right spot else INHOME=0 fi - end="${end#/}" # Strip the first / - shortenedpath="$end" # The whole path, to check the length. + end="${end#/}" # Strip the first / + shortenedpath="${end}" # The whole path, to check the length. maxlength="${1:-0}" shopt -q nullglob && NGV="-s" || NGV="-u" # Store the value for later. shopt -s nullglob # Without this, anything that doesn't exist in the filesystem turns into */*/*/... - while [[ "$end" ]] && ((${#shortenedpath} > maxlength)); do + while [[ "${end}" ]] && ((${#shortenedpath} > maxlength)); do current="${end%%/*}" # everything before the first / end="${end#*/}" # everything after the first / @@ -69,10 +72,10 @@ _swd() { for ((i = ${#current} - 2; i >= 0; i--)); do subcurrent="${current:0:i}" - matching=("$begin/$subcurrent"*) # Array of all files that start with $subcurrent. - ((${#matching[*]} != 1)) && break # Stop shortening if more than one file matches. - shortcur="$subcurrent" - shortcurstar="$subcurrent*" + matching=("${begin}/${subcurrent}"*) # Array of all files that start with $subcurrent. + ((${#matching[*]} != 1)) && break # Stop shortening if more than one file matches. + shortcur="${subcurrent}" + shortcurstar="${subcurrent}*" done #advance @@ -86,6 +89,7 @@ _swd() { # Replaces slashes with  except first occurence. if [ $INHOME -eq 1 ]; then + # shellcheck disable=SC2088 echo "~/$shortenedpath" | sed "s/\///2g" # make sure it starts with ~/ else echo "/$shortenedpath" | sed "s/\///2g" # Make sure it starts with / @@ -107,10 +111,10 @@ function set_rgb_color { function powerline_shell_prompt { if [[ -n "${SSH_CLIENT}" ]]; then - SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_SSH_THEME_PROMPT_COLOR}) ${SHELL_SSH_CHAR}\u@\h ${normal}" + SHELL_PROMPT="${bold_white?}$(set_rgb_color - ${SHELL_SSH_THEME_PROMPT_COLOR}) ${SHELL_SSH_CHAR}\u@\h ${normal?}" LAST_THEME_COLOR=${SHELL_SSH_THEME_PROMPT_COLOR} else - SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_THEME_PROMPT_COLOR}) ${normal}" + SHELL_PROMPT="${bold_white?}$(set_rgb_color - ${SHELL_THEME_PROMPT_COLOR}) ${normal?}" LAST_THEME_COLOR=${SHELL_THEME_PROMPT_COLOR} fi } @@ -125,7 +129,7 @@ function powerline_virtualenv_prompt { fi if [[ -n "$environ" ]]; then - VIRTUALENV_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${VIRTUALENV_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$environ ${normal}" + VIRTUALENV_PROMPT="$(set_rgb_color "${LAST_THEME_COLOR}" "${VIRTUALENV_THEME_PROMPT_COLOR}")${THEME_PROMPT_SEPARATOR}${normal?}$(set_rgb_color - "${VIRTUALENV_THEME_PROMPT_COLOR}") ${VIRTUALENV_CHAR}$environ ${normal?}" LAST_THEME_COLOR=${VIRTUALENV_THEME_PROMPT_COLOR} else VIRTUALENV_PROMPT="" @@ -137,18 +141,18 @@ function powerline_scm_prompt { if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then if [[ "${SCM_DIRTY}" -eq 3 ]]; then - SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_STAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" + SCM_PROMPT="$(set_rgb_color "${SCM_THEME_PROMPT_STAGED_COLOR}" "${SCM_THEME_PROMPT_COLOR}")" elif [[ "${SCM_DIRTY}" -eq 2 ]]; then - SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_UNSTAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" + SCM_PROMPT="$(set_rgb_color "${SCM_THEME_PROMPT_UNSTAGED_COLOR}" "${SCM_THEME_PROMPT_COLOR}")" elif [[ "${SCM_DIRTY}" -eq 1 ]]; then - SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} ${SCM_THEME_PROMPT_COLOR})" + SCM_PROMPT="$(set_rgb_color "${SCM_THEME_PROMPT_DIRTY_COLOR}" "${SCM_THEME_PROMPT_COLOR}")" else - SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_CLEAN_COLOR} ${SCM_THEME_PROMPT_COLOR})" + SCM_PROMPT="$(set_rgb_color "${SCM_THEME_PROMPT_CLEAN_COLOR}" "${SCM_THEME_PROMPT_COLOR}")" fi if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then SCM_PROMPT+=" ${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" fi - SCM_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${SCM_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}${SCM_PROMPT} ${normal}" + SCM_PROMPT="$(set_rgb_color "${LAST_THEME_COLOR}" "${SCM_THEME_PROMPT_COLOR}")${THEME_PROMPT_SEPARATOR}${normal?}${SCM_PROMPT} ${normal?}" LAST_THEME_COLOR=${SCM_THEME_PROMPT_COLOR} else SCM_PROMPT="" @@ -156,15 +160,16 @@ function powerline_scm_prompt { } function powerline_cwd_prompt { - CWD_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${CWD_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}$(set_rgb_color 0 ${CWD_THEME_PROMPT_COLOR}) $(_swd)${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}" + # shellcheck disable=SC2119 + CWD_PROMPT="$(set_rgb_color "${LAST_THEME_COLOR}" "${CWD_THEME_PROMPT_COLOR}")${THEME_PROMPT_SEPARATOR}$(set_rgb_color 0 "${CWD_THEME_PROMPT_COLOR}") $(_swd)${normal?}$(set_rgb_color "${CWD_THEME_PROMPT_COLOR}" -)${normal?}" LAST_THEME_COLOR=${CWD_THEME_PROMPT_COLOR} } function powerline_last_status_prompt { if [[ "$1" -eq 0 ]]; then - LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}" + LAST_STATUS_PROMPT="$(set_rgb_color "${LAST_THEME_COLOR}" -)${THEME_PROMPT_SEPARATOR}${normal?}" else - LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${LAST_STATUS_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${LAST_STATUS_THEME_PROMPT_COLOR}) ${LAST_STATUS} ${normal}$(set_rgb_color ${LAST_STATUS_THEME_PROMPT_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}" + LAST_STATUS_PROMPT="$(set_rgb_color "${LAST_THEME_COLOR}" "${LAST_STATUS_THEME_PROMPT_COLOR}")${THEME_PROMPT_SEPARATOR}${normal?}$(set_rgb_color - "${LAST_STATUS_THEME_PROMPT_COLOR}") ${LAST_STATUS} ${normal?}$(set_rgb_color "${LAST_STATUS_THEME_PROMPT_COLOR}" -)${THEME_PROMPT_SEPARATOR}${normal?}" fi } diff --git a/themes/primer/primer.theme.bash b/themes/primer/primer.theme.bash index f6169cd039..13b28a5a32 100644 --- a/themes/primer/primer.theme.bash +++ b/themes/primer/primer.theme.bash @@ -1,11 +1,12 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. # based of the candy theme, but minimized by odbol function prompt_command() { - PS1="$(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue} →${bold_blue} ${reset_color} " + PS1="$(clock_prompt) ${reset_color?}${white?}\w${reset_color?}$(scm_prompt_info)${blue?} →${bold_blue?} ${reset_color?} " } -THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"} +THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"${blue?}"} THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"} safe_append_prompt_command prompt_command diff --git a/themes/pro/pro.theme.bash b/themes/pro/pro.theme.bash index 449915bb34..8dd128233a 100644 --- a/themes/pro/pro.theme.bash +++ b/themes/pro/pro.theme.bash @@ -1,14 +1,15 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" -SCM_THEME_PROMPT_PREFIX=" ${blue}scm:( " -SCM_THEME_PROMPT_SUFFIX="${blue} )" +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${green?}✓" +SCM_THEME_PROMPT_PREFIX=" ${blue?}scm:( " +SCM_THEME_PROMPT_SUFFIX="${blue?} )" -GIT_THEME_PROMPT_DIRTY=" ${red}✗" -GIT_THEME_PROMPT_CLEAN=" ${green}✓" -GIT_THEME_PROMPT_PREFIX="${green}git:( " -GIT_THEME_PROMPT_SUFFIX="${green} )" +GIT_THEME_PROMPT_DIRTY=" ${red?}✗" +GIT_THEME_PROMPT_CLEAN=" ${green?}✓" +GIT_THEME_PROMPT_PREFIX="${green?}git:( " +GIT_THEME_PROMPT_SUFFIX="${green?} )" function git_prompt_info { git_prompt_vars @@ -16,7 +17,7 @@ function git_prompt_info { } function prompt() { - PS1="\h: \W $(scm_prompt_info)${reset_color} $ " + PS1="\h: \W $(scm_prompt_info)${reset_color?} $ " } safe_append_prompt_command prompt diff --git a/themes/purity/purity.theme.bash b/themes/purity/purity.theme.bash index 0fc6c4cfa8..c2b78a5944 100644 --- a/themes/purity/purity.theme.bash +++ b/themes/purity/purity.theme.bash @@ -13,7 +13,7 @@ GIT_THEME_PROMPT_SUFFIX=" ${reset_color?})" STATUS_THEME_PROMPT_BAD="${bold_red?}❯${reset_color?}${normal?} " STATUS_THEME_PROMPT_OK="${bold_green?}❯${reset_color?}${normal?} " -: "${PURITY_THEME_PROMPT_COLOR:=$blue}" +: "${PURITY_THEME_PROMPT_COLOR:=${blue?}}" function venv_prompt() { python_venv="" diff --git a/themes/radek/radek.theme.bash b/themes/radek/radek.theme.bash index 7983121174..6b5f1222ac 100644 --- a/themes/radek/radek.theme.bash +++ b/themes/radek/radek.theme.bash @@ -1,19 +1,20 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. -GIT_THEME_PROMPT_DIRTY="${red}✗" -GIT_THEME_PROMPT_CLEAN="${bold_green}✓" -GIT_THEME_PROMPT_PREFIX="${bold_cyan}[" -GIT_THEME_PROMPT_SUFFIX="${bold_cyan}]" +GIT_THEME_PROMPT_DIRTY="${red?}✗" +GIT_THEME_PROMPT_CLEAN="${bold_green?}✓" +GIT_THEME_PROMPT_PREFIX="${bold_cyan?}[" +GIT_THEME_PROMPT_SUFFIX="${bold_cyan?}]" -VIRTUALENV_THEME_PROMPT_PREFIX="${bold_green}[" -VIRTUALENV_THEME_PROMPT_SUFFIX="${bold_green}]" -CONDAENV_THEME_PROMPT_PREFIX="${bold_green}[" -CONDAENV_THEME_PROMPT_SUFFIX="${bold_green}]" -PYTHON_THEME_PROMPT_PREFIX="${bold_green}[" -PYTHON_THEME_PROMPT_SUFFIX="${bold_green}]" +VIRTUALENV_THEME_PROMPT_PREFIX="${bold_green?}[" +VIRTUALENV_THEME_PROMPT_SUFFIX="${bold_green?}]" +CONDAENV_THEME_PROMPT_PREFIX="${bold_green?}[" +CONDAENV_THEME_PROMPT_SUFFIX="${bold_green?}]" +PYTHON_THEME_PROMPT_PREFIX="${bold_green?}[" +PYTHON_THEME_PROMPT_SUFFIX="${bold_green?}]" function prompt_command() { - PS1="\n${bold_white}[\u@\h]${bold_yellow}[\w] ${bold_cyan}$(scm_prompt_char_info)$(python_version_prompt)${green}\n→${reset_color} " + PS1="\n${bold_white?}[\u@\h]${bold_yellow?}[\w] ${bold_cyan?}$(scm_prompt_char_info)$(python_version_prompt)${green?}\n→${reset_color?} " } safe_append_prompt_command prompt_command diff --git a/themes/rainbowbrite/rainbowbrite.theme.bash b/themes/rainbowbrite/rainbowbrite.theme.bash index 37cab72412..45f29f8223 100644 --- a/themes/rainbowbrite/rainbowbrite.theme.bash +++ b/themes/rainbowbrite/rainbowbrite.theme.bash @@ -1,4 +1,5 @@ # shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. # based off of n0qorg # looks like, if you're in a git repo: @@ -9,9 +10,9 @@ prompt_setter() { # Save history _save-and-reload-history 1 # displays user@server in purple - # PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " + # PS1="${red?}$(scm_char) ${purple?}\u@\h${reset_color?}:${blue?}\w${yellow?}$(scm_prompt_info)$(ruby_version_prompt) ${black?}\$${reset_color?} " # no user@server - PS1="$red$(scm_char) $blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " + PS1="${red?}$(scm_char) ${blue?}\w${yellow?}$(scm_prompt_info)$(ruby_version_prompt) ${black?}\$${reset_color?} " PS2='> ' PS4='+ ' } @@ -19,9 +20,9 @@ prompt_setter() { safe_append_prompt_command prompt_setter SCM_NONE_CHAR='·' -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${green?}✓" SCM_THEME_PROMPT_PREFIX=" (" -SCM_THEME_PROMPT_SUFFIX="${yellow})" +SCM_THEME_PROMPT_SUFFIX="${yellow?})" RVM_THEME_PROMPT_PREFIX=" (" RVM_THEME_PROMPT_SUFFIX=")" diff --git a/themes/ramses/ramses.theme.bash b/themes/ramses/ramses.theme.bash index ee4fdbdab1..c025c84d91 100644 --- a/themes/ramses/ramses.theme.bash +++ b/themes/ramses/ramses.theme.bash @@ -1,11 +1,14 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" -SCM_GIT_CHAR="${bold_green}±${normal}" -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" +SCM_GIT_CHAR="${bold_green?}±${normal?}" +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" #Mysql Prompt export MYSQL_PS1="(\u@\h) [\d]> " @@ -22,23 +25,24 @@ esac PS3=">> " __my_rvm_ruby_version() { - local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') - [ "$gemset" != "" ] && gemset="@$gemset" - local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') + local version gemset + gemset=$(echo "$GEM_HOME" | awk -F'@' '{print $2}') + [[ -n "$gemset" ]] && gemset="@$gemset" + version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}') local full="$version$gemset" - [ "$full" != "" ] && echo "[$full]" + [[ -n "$full" ]] && echo "[$full]" } is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ]; then - echo "[${cyan}vim shell${normal}]" + if [[ -n "$VIMRUNTIME" ]]; then + echo "[${cyan?}vim shell${normal?}]" fi } # show chroot if exist chroot() { - if [ -n "$debian_chroot" ]; then - my_ps_chroot="${bold_cyan}$debian_chroot${normal}" + if [[ -n "$debian_chroot" ]]; then + my_ps_chroot="${bold_cyan?}$debian_chroot${normal?}" echo "($my_ps_chroot)" fi } @@ -46,11 +50,11 @@ chroot() { # show virtualenvwrapper my_ve() { - if [ -n "$CONDA_DEFAULT_ENV" ]; then - my_ps_ve="${bold_purple}${CONDA_DEFAULT_ENV}${normal}" + if [[ -n "$CONDA_DEFAULT_ENV" ]]; then + my_ps_ve="${bold_purple?}${CONDA_DEFAULT_ENV}${normal?}" echo "($my_ps_ve)" elif [ -n "$VIRTUAL_ENV" ]; then - my_ps_ve="${bold_purple}$ve${normal}" + my_ps_ve="${bold_purple?}$ve${normal?}" echo "($my_ps_ve)" fi echo "" @@ -58,12 +62,12 @@ my_ve() { prompt() { SCM_PROMPT_FORMAT='[%s][%s]' - my_ps_host="${green}\h${normal}" + my_ps_host="${green?}\h${normal?}" # yes, these are the the same for now ... - my_ps_host_root="${green}\h${normal}" + my_ps_host_root="${green?}\h${normal?}" - my_ps_user="${bold_green}\u${normal}" - my_ps_root="${bold_red}\u${normal}" + my_ps_user="${bold_green?}\u${normal?}" + my_ps_root="${bold_red?}\u${normal?}" if [ -n "$VIRTUAL_ENV" ]; then ve=$(basename "$VIRTUAL_ENV") @@ -72,12 +76,12 @@ prompt() { # nice prompt case "$(id -u)" in 0) - PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}] + PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan?}\w${normal?}] ▪ " ;; *) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version) -|─[${bold_purple}\w${normal}] +|─[${bold_purple?}\w${normal?}] ▪ " ;; esac diff --git a/themes/rana/rana.theme.bash b/themes/rana/rana.theme.bash index 41b7bba446..aa35bcc0c2 100644 --- a/themes/rana/rana.theme.bash +++ b/themes/rana/rana.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034,SC2312 # Expected behavior for themes. # Theme inspired on: # - Ronacher's dotfiles (mitsuhikos) - http://github.com/mitsuhiko/dotfiles/tree/master/bash/ @@ -11,24 +12,24 @@ # For the real Monokai colors you should add these to your .XDefaults or # terminal configuration: -#! ----------------------------------------------------------- TERMINAL COLORS -#! monokai - http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/ +# ----------------------------------------------------------- TERMINAL COLORS +# monokai - http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/ #*background: #272822 #*foreground: #E2DA6E #*color0: black -#! mild red +# mild red #*color1: #CD0000 -#! light green +# light green #*color2: #A5E02D -#! orange (yellow) +# orange (yellow) #*color3: #FB951F -#! "dark" blue +# "dark" blue #*color4: #076BCC -#! hot pink +# hot pink #*color5: #F6266C -#! cyan +# cyan #*color6: #64D9ED -#! gray +# gray #*color7: #E5E5E5 # ----------------------------------------------------------------- DEF COLOR @@ -89,14 +90,14 @@ case $TERM in esac is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ]; then + if [[ -n "$VIMRUNTIME" ]]; then echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}\ vim shell${D_DEFAULT_COLOR} " fi } mitsuhikos_lastcommandfailed() { - code=$? + local code=$? if [ $code != 0 ]; then echo "${D_INTERMEDIATE_COLOR}exited ${D_CMDFAIL_COLOR}\ $code ${D_DEFAULT_COLOR}" @@ -105,7 +106,7 @@ $code ${D_DEFAULT_COLOR}" # vcprompt for scm instead of bash_it default demula_vcprompt() { - if [ ! -z "$VCPROMPT_EXECUTABLE" ]; then + if [[ -n "$VCPROMPT_EXECUTABLE" ]]; then local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" $VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT" @@ -117,10 +118,7 @@ prompt_git() { local branchName='' # Check if the current directory is in a Git repository. - if [ $( - git rev-parse --is-inside-work-tree &> /dev/null - echo "${?}" - ) == '0' ]; then + if git rev-parse --is-inside-work-tree &> /dev/null; then # check if the current directory is in .git before running git checks if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then @@ -129,22 +127,22 @@ prompt_git() { git update-index --really-refresh -q &> /dev/null # Check for uncommitted changes in the index. - if ! $(git diff --quiet --ignore-submodules --cached); then + if ! git diff --quiet --ignore-submodules --cached; then s+='+' fi # Check for unstaged changes. - if ! $(git diff-files --quiet --ignore-submodules --); then + if ! git diff-files --quiet --ignore-submodules --; then s+='!' fi # Check for untracked files. - if [ -n "$(git ls-files --others --exclude-standard)" ]; then + if [[ -n "$(git ls-files --others --exclude-standard)" ]]; then s+='?' fi # Check for stashed files. - if $(git rev-parse --verify refs/stash &> /dev/null); then + if git rev-parse --verify refs/stash &> /dev/null; then s+='$' fi @@ -157,7 +155,7 @@ prompt_git() { || git rev-parse --short HEAD 2> /dev/null \ || echo '(unknown)')" - [ -n "${s}" ] && s=" [${s}]" + [[ -n "${s}" ]] && s=" [${s}]" echo -e "${1}${branchName}${Cya}${s}" else @@ -167,13 +165,14 @@ prompt_git() { # -------------------------------------------------------------- PROMPT OUTPUT prompt() { - local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed) + local LAST_COMMAND_FAILED + LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed) local SAVE_CURSOR='\033[s' local RESTORE_CURSOR='\033[u' local MOVE_CURSOR_RIGHTMOST='\033[500C' local MOVE_CURSOR_5_LEFT='\033[5D' - if [[ "$OSTYPE" == 'linux'* ]]; then + if [[ "${OSTYPE}" == 'linux'* ]]; then PS1="${TITLEBAR} ${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ $(battery_charge)${RESTORE_CURSOR}\ diff --git a/themes/redline/redline.theme.bash b/themes/redline/redline.theme.bash index 65bf6f0a55..0a68f5f58e 100644 --- a/themes/redline/redline.theme.bash +++ b/themes/redline/redline.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. . "$BASH_IT/themes/powerline/powerline.base.bash" diff --git a/themes/rjorgenson/rjorgenson.theme.bash b/themes/rjorgenson/rjorgenson.theme.bash index c41ebff025..7f5ce5cebb 100644 --- a/themes/rjorgenson/rjorgenson.theme.bash +++ b/themes/rjorgenson/rjorgenson.theme.bash @@ -5,17 +5,17 @@ # set colors for use throughout the prompt # i like things consistent -BRACKET_COLOR=${blue} -STRING_COLOR=${green} +BRACKET_COLOR=${blue?} +STRING_COLOR=${green?} SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" -SCM_GIT_CHAR="${STRING_COLOR}±${normal}" -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" +SCM_GIT_CHAR="${STRING_COLOR}±${normal?}" +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" #Mysql Prompt export MYSQL_PS1="(\u@\h) [\d]> " @@ -37,12 +37,12 @@ __my_rvm_ruby_version() { [[ "$gemset" != "" ]] && gemset="@$gemset" version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}') full="$version$gemset" - [[ "$full" != "" ]] && echo "${BRACKET_COLOR}[${STRING_COLOR}$full${BRACKET_COLOR}]${normal}" + [[ "$full" != "" ]] && echo "${BRACKET_COLOR}[${STRING_COLOR}$full${BRACKET_COLOR}]${normal?}" } is_vim_shell() { if [[ -n "$VIMRUNTIME" ]]; then - echo "${BRACKET_COLOR}[${STRING_COLOR}vim shell${BRACKET_COLOR}]${normal}" + echo "${BRACKET_COLOR}[${STRING_COLOR}vim shell${BRACKET_COLOR}]${normal?}" fi } @@ -55,32 +55,32 @@ todo_txt_count() { if hash todo.sh 2>&-; then # is todo.sh installed count=$(todo.sh ls | grep -E "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }') if is_integer "$count"; then # did we get a sane answer back - echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]$normal" + echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]${normal?}" fi fi } my_prompt_char() { if [[ $OSTYPE =~ "darwin" ]]; then - echo "${BRACKET_COLOR}➞ ${normal}" + echo "${BRACKET_COLOR}➞ ${normal?}" else - echo "${BRACKET_COLOR}➞ ${normal}" + echo "${BRACKET_COLOR}➞ ${normal?}" fi } prompt() { SCM_PROMPT_FORMAT="${BRACKET_COLOR}[%s${BRACKET_COLOR}][${STRING_COLOR}%s${BRACKET_COLOR}]" - my_ps_host="${STRING_COLOR}\h${normal}" - my_ps_user="${STRING_COLOR}\u${normal}" - my_ps_root="${bold_red}\u${normal}" - my_ps_path="${STRING_COLOR}\w${normal}" + my_ps_host="${STRING_COLOR}\h${normal?}" + my_ps_user="${STRING_COLOR}\u${normal?}" + my_ps_root="${bold_red?}\u${normal?}" + my_ps_path="${STRING_COLOR}\w${normal?}" # nice prompt case "$(id -u)" in 0) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_root${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell) -${BRACKET_COLOR}└─$(my_prompt_char)${normal}" +${BRACKET_COLOR}└─$(my_prompt_char)${normal?}" ;; *) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_user${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell) diff --git a/themes/robbyrussell/robbyrussell.theme.bash b/themes/robbyrussell/robbyrussell.theme.bash index 11aa5ef673..542361783d 100644 --- a/themes/robbyrussell/robbyrussell.theme.bash +++ b/themes/robbyrussell/robbyrussell.theme.bash @@ -1,14 +1,15 @@ # shellcheck shell=bash # shellcheck disable=SC2034,SC2154 -SCM_THEME_PROMPT_DIRTY=" ${bold_yellow}✗" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" -SCM_THEME_PROMPT_PREFIX=" ${bold_blue}scm:(" -SCM_THEME_PROMPT_SUFFIX="${bold_blue})" -GIT_THEME_PROMPT_DIRTY=" ${bold_yellow}✗" -GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" -GIT_THEME_PROMPT_PREFIX=" ${bold_blue}git:(" -GIT_THEME_PROMPT_SUFFIX="${bold_blue})" +SCM_THEME_PROMPT_DIRTY=" ${bold_yellow?}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓" +SCM_THEME_PROMPT_PREFIX=" ${bold_blue?}scm:(" +SCM_THEME_PROMPT_SUFFIX="${bold_blue?})" + +GIT_THEME_PROMPT_DIRTY=" ${bold_yellow?}✗" +GIT_THEME_PROMPT_CLEAN=" ${bold_green?}✓" +GIT_THEME_PROMPT_PREFIX=" ${bold_blue?}git:(" +GIT_THEME_PROMPT_SUFFIX="${bold_blue?})" RVM_THEME_PROMPT_PREFIX="|" RVM_THEME_PROMPT_SUFFIX="|" @@ -18,11 +19,11 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=') ' function git_prompt_info() { git_prompt_vars - echo -e "$SCM_PREFIX${bold_red}$SCM_BRANCH$SCM_STATE$SCM_SUFFIX" + echo -e "$SCM_PREFIX${bold_red?}$SCM_BRANCH$SCM_STATE$SCM_SUFFIX" } function prompt_command() { - PS1="$(conda_or_venv_prompt)${bold_green}➜ ${bold_cyan}\W${reset_color}$(scm_prompt_info)${normal} " + PS1="$(conda_or_venv_prompt)${bold_green?}➜ ${bold_cyan?}\W${reset_color?}$(scm_prompt_info)${normal?} " } PROMPT_COMMAND=prompt_command diff --git a/themes/roderik/roderik.theme.bash b/themes/roderik/roderik.theme.bash index cb7252784e..8a6fd2a85a 100644 --- a/themes/roderik/roderik.theme.bash +++ b/themes/roderik/roderik.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. export GIT_PS1_SHOWDIRTYSTATE=true export GIT_PS1_SHOWUNTRACKEDFILES=true @@ -8,9 +9,9 @@ export PROMPT_DIRTRIM=3 function prompt_command() { if [[ ${EUID} == 0 ]]; then - PS1="[$(clock_prompt)]${yellow}[${red}\u@\h ${green}\w${yellow}]${red}$(__git_ps1 "(%s)")${normal}\\$ " + PS1="[$(clock_prompt)]${yellow?}[${red?}\u@\h ${green?}\w${yellow?}]${red?}$(__git_ps1 "(%s)")${normal?}\\$ " else - PS1="[$(clock_prompt)]${yellow}[${cyan}\u@\h ${green}\w${yellow}]${red}$(__git_ps1 "(%s)")${normal}\\$ " + PS1="[$(clock_prompt)]${yellow?}[${cyan?}\u@\h ${green?}\w${yellow?}]${red?}$(__git_ps1 "(%s)")${normal?}\\$ " fi } diff --git a/themes/sexy/sexy.theme.bash b/themes/sexy/sexy.theme.bash index 6a59c66528..6dc4664b59 100644 --- a/themes/sexy/sexy.theme.bash +++ b/themes/sexy/sexy.theme.bash @@ -1,3 +1,6 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt" # Screenshot: http://cloud.gf3.ca/M5rG # A big thanks to \amethyst on Freenode diff --git a/themes/simple/simple.theme.bash b/themes/simple/simple.theme.bash index 5f34636c58..8d38c0fa3e 100644 --- a/themes/simple/simple.theme.bash +++ b/themes/simple/simple.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. # prompt themeing @@ -13,7 +14,7 @@ case $TERM in esac function prompt_command() { - PS1="${TITLEBAR}${orange}${reset_color}${green}\w${bold_blue}\[$(scm_prompt_info)\]${normal} " + PS1="${TITLEBAR}${orange?}${reset_color?}${green?}\w${bold_blue?}\[$(scm_prompt_info)\]${normal?} " } # scm themeing diff --git a/themes/sirup/sirup.theme.bash b/themes/sirup/sirup.theme.bash index 73e957837f..47f620260e 100644 --- a/themes/sirup/sirup.theme.bash +++ b/themes/sirup/sirup.theme.bash @@ -1,22 +1,22 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # For unstaged(*) and staged(+) values next to branch name in __git_ps1 GIT_PS1_SHOWDIRTYSTATE="enabled" function rvm_version_prompt { - local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') - - [ "$gemset" != "" ] && gemset="@$gemset" - local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') - - [ "$version" == "1.9.2" ] && version="" - + local gemset version + gemset=$(echo "$GEM_HOME" | awk -F'@' '{print $2}') + [[ -n "$gemset" ]] && gemset="@$gemset" + version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}') + [[ "$version" == "1.9.2" ]] && version="" local full="$version$gemset" - - [ "$full" != "" ] && echo "$full" + [[ -n "$full" ]] && echo "$full" } function prompt_command() { # Check http://github.com/Sirupsen/dotfiles for screenshot - PS1="$blue\W/$bold_blue$(rvm_version_prompt)$bold_green$(__git_ps1 " (%s)") ${normal}$ " + PS1="${blue?}\W/${bold_blue?}$(rvm_version_prompt)${bold_green?}$(__git_ps1 " (%s)") ${normal?}$ " } safe_append_prompt_command prompt_command diff --git a/themes/slick/slick.theme.bash b/themes/slick/slick.theme.bash index f4b59aa14a..bb75f09dee 100644 --- a/themes/slick/slick.theme.bash +++ b/themes/slick/slick.theme.bash @@ -1,11 +1,14 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" -SCM_GIT_CHAR="${bold_cyan}±${normal}" -SCM_SVN_CHAR="${bold_green}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" +SCM_GIT_CHAR="${bold_cyan?}±${normal?}" +SCM_SVN_CHAR="${bold_green?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" #Mysql Prompt export MYSQL_PS1="(\u@\h) [\d]> " @@ -22,22 +25,23 @@ esac PS3=">> " __my_rvm_ruby_version() { - local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') - [ "$gemset" != "" ] && gemset="@$gemset" - local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') + local gemset version + gemset=$(echo "$GEM_HOME" | awk -F'@' '{print $2}') + [[ "$gemset" ]] && gemset="@$gemset" + version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}') local full="$version$gemset" - [ "$full" != "" ] && echo "[$full]" + [[ "$full" ]] && echo "[$full]" } __my_venv_prompt() { - if [ ! -z "$VIRTUAL_ENV" ]; then - echo "[${blue}@${normal}${VIRTUAL_ENV##*/}]" + if [[ -n "$VIRTUAL_ENV" ]]; then + echo "[${blue?}@${normal?}${VIRTUAL_ENV##*/}]" fi } is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ]; then - echo "[${cyan}vim shell${normal}]" + if [[ -n "$VIMRUNTIME" ]]; then + echo "[${cyan?}vim shell${normal?}]" fi } @@ -45,13 +49,13 @@ prompt() { SCM_PROMPT_FORMAT='[%s][%s]' case $HOSTNAME in "clappy"*) - my_ps_host="${green}\h${normal}" + my_ps_host="${green?}\h${normal?}" ;; "icekernel") - my_ps_host="${red}\h${normal}" + my_ps_host="${red?}\h${normal?}" ;; *) - my_ps_host="${green}\h${normal}" + my_ps_host="${green?}\h${normal?}" ;; esac @@ -62,11 +66,11 @@ prompt() { # nice prompt case "$(id -u)" in 0) - PS1="${TITLEBAR}[$my_ps_root][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) + PS1="${TITLEBAR}[$my_ps_root][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan?}\w${normal?}]$(is_vim_shell) $ " ;; *) - PS1="${TITLEBAR}[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)$(__my_venv_prompt)[${cyan}\w${normal}]$(is_vim_shell) + PS1="${TITLEBAR}[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)$(__my_venv_prompt)[${cyan?}\w${normal?}]$(is_vim_shell) $ " ;; esac diff --git a/themes/standard/standard.theme.bash b/themes/standard/standard.theme.bash index 1f9f8795d7..b550d5ebd3 100644 --- a/themes/standard/standard.theme.bash +++ b/themes/standard/standard.theme.bash @@ -1,3 +1,6 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # scm themeing SCM_THEME_PROMPT_DIRTY="×" SCM_THEME_PROMPT_CLEAN="✓" @@ -18,7 +21,8 @@ case $TERM in esac function prompt_command() { - PROMPT='${green}\u${normal}@${green}\h${normal}:${blue}\w${normal}${red}$(prompt_char)$(git_prompt_info)${normal}\$ ' + # shellcheck disable=SC2016 + PROMPT='${green?}\u${normal?}@${green?}\h${normal?}:${blue?}\w${normal?}${red?}$(prompt_char)$(git_prompt_info)${normal?}\$ ' } safe_append_prompt_command prompt_command diff --git a/themes/tonka/tonka.theme.bash b/themes/tonka/tonka.theme.bash index 06f091f300..63632329b9 100644 --- a/themes/tonka/tonka.theme.bash +++ b/themes/tonka/tonka.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. __tonka_time() { THEME_CLOCK_FORMAT="%H%M" diff --git a/themes/tonotdo/tonotdo.theme.bash b/themes/tonotdo/tonotdo.theme.bash index 63296eaad7..0334e88ed0 100644 --- a/themes/tonotdo/tonotdo.theme.bash +++ b/themes/tonotdo/tonotdo.theme.bash @@ -1,13 +1,14 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. -SCM_THEME_PROMPT_PREFIX=" ${purple}" -SCM_THEME_PROMPT_SUFFIX=" ${normal}" -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" +SCM_THEME_PROMPT_PREFIX=" ${purple?}" +SCM_THEME_PROMPT_SUFFIX=" ${normal?}" +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${green?}✓" SCM_GIT_SHOW_DETAILS="false" function prompt_command() { - PS1="${yellow}\u${normal}${cyan}@\h${normal}${purple} ${normal}${green}\w${normal}$(scm_prompt_info)> " + PS1="${yellow?}\u${normal?}${cyan?}@\h${normal?}${purple?} ${normal?}${green?}\w${normal?}$(scm_prompt_info)> " } safe_append_prompt_command prompt_command diff --git a/themes/tylenol/tylenol.theme.bash b/themes/tylenol/tylenol.theme.bash index 560be51912..9a264db3fe 100644 --- a/themes/tylenol/tylenol.theme.bash +++ b/themes/tylenol/tylenol.theme.bash @@ -1,12 +1,13 @@ -#!/usr/bin/env bash -# +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # Based on 'bobby' theme with the addition of virtualenv_prompt # -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" -SCM_THEME_PROMPT_PREFIX=" ${yellow}|${reset_color}" -SCM_THEME_PROMPT_SUFFIX="${yellow}|" +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${green?}✓" +SCM_THEME_PROMPT_PREFIX=" ${yellow?}|${reset_color?}" +SCM_THEME_PROMPT_SUFFIX="${yellow?}|" RVM_THEME_PROMPT_PREFIX="|" RVM_THEME_PROMPT_SUFFIX="|" @@ -14,7 +15,7 @@ VIRTUALENV_THEME_PROMPT_PREFIX='|' VIRTUALENV_THEME_PROMPT_SUFFIX='|' function prompt_command() { - PS1="\n${green}$(virtualenv_prompt)${red}$(ruby_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} " + PS1="\n${green?}$(virtualenv_prompt)${red?}$(ruby_version_prompt) ${reset_color?}\h ${orange?}in ${reset_color?}\w\n${yellow?}$(scm_char)$(scm_prompt_info) ${yellow?}→${white?} " } safe_append_prompt_command prompt_command diff --git a/themes/wanelo/wanelo.theme.bash b/themes/wanelo/wanelo.theme.bash index 88d174014d..374c0ea7dc 100644 --- a/themes/wanelo/wanelo.theme.bash +++ b/themes/wanelo/wanelo.theme.bash @@ -1,13 +1,15 @@ -#!/usr/bin/env bash -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + +SCM_THEME_PROMPT_DIRTY=" ${red?}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓" SCM_THEME_PROMPT_PREFIX=" |" -SCM_THEME_PROMPT_SUFFIX="${green}|" +SCM_THEME_PROMPT_SUFFIX="${green?}|" -GIT_THEME_PROMPT_DIRTY=" ${red}✗" -GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" -GIT_THEME_PROMPT_PREFIX=" ${green}|" -GIT_THEME_PROMPT_SUFFIX="${green}|" +GIT_THEME_PROMPT_DIRTY=" ${red?}✗" +GIT_THEME_PROMPT_CLEAN=" ${bold_green?}✓" +GIT_THEME_PROMPT_PREFIX=" ${green?}|" +GIT_THEME_PROMPT_SUFFIX="${green?}|" RVM_THEME_PROMPT_PREFIX="|" RVM_THEME_PROMPT_SUFFIX="|" @@ -18,9 +20,9 @@ function prompt_command() { else status=💔 fi - PS1="\n${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w $status \n${bold_cyan} ${blue}|$(clock_prompt)|${green}$(scm_prompt_info) ${green}→${reset_color} " + PS1="\n${yellow?}$(ruby_version_prompt) ${purple?}\h ${reset_color?}in ${green?}\w $status \n${bold_cyan?} ${blue?}|$(clock_prompt)|${green?}$(scm_prompt_info) ${green}→${reset_color?} " } -THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"} +THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"${blue?}"} PROMPT_COMMAND=prompt_command diff --git a/themes/zitron/zitron.theme.bash b/themes/zitron/zitron.theme.bash index 7100052702..54272f11e6 100644 --- a/themes/zitron/zitron.theme.bash +++ b/themes/zitron/zitron.theme.bash @@ -1,9 +1,11 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + # zitron theme by Florian Baumann ## git-theme # feel free to change git chars. -GIT_THEME_PROMPT_DIRTY="${bold_yellow}*${normal}" +GIT_THEME_PROMPT_DIRTY="${bold_yellow?}*${normal?}" GIT_THEME_PROMPT_CLEAN="" GIT_THEME_PROMPT_PREFIX="" GIT_THEME_PROMPT_SUFFIX="" @@ -18,7 +20,7 @@ function prompt_command() { # user:host:pwd git-branch(*)$ # for example: # noqqe:deathstar:themes master*$ - PS1="${no_color}\u:$(hostname)${normal}:${bold_yellow}\W/${normal} $(git_prompt_info)${reset_color}$ " + PS1="${reset_color?}\u:$(hostname)${normal?}:${bold_yellow?}\W/${normal?} $(git_prompt_info)${reset_color?}$ " } safe_append_prompt_command prompt_command diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index 034b92054a..137059d03e 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -1,11 +1,14 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Expected behavior for themes. + SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" -SCM_GIT_CHAR="${bold_green}±${normal}" -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" -SCM_HG_CHAR="${bold_red}☿${normal}" +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" +SCM_GIT_CHAR="${bold_green?}±${normal?}" +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" +SCM_HG_CHAR="${bold_red?}☿${normal?}" #Mysql Prompt export MYSQL_PS1="(\u@\h) [\d]> " @@ -22,23 +25,24 @@ esac PS3=">> " __my_rvm_ruby_version() { - local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') - [ "$gemset" != "" ] && gemset="@$gemset" - local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') + local gemset version + gemset=$(echo "$GEM_HOME" | awk -F'@' '{print $2}') + [[ -n "$gemset" ]] && gemset="@$gemset" + version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}') local full="$version$gemset" - [ "$full" != "" ] && echo "[$full]" + [[ -n "$full" ]] && echo "[$full]" } is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ]; then - echo "[${cyan}vim shell${normal}]" + if [[ -n "$VIMRUNTIME" ]]; then + echo "[${cyan?}vim shell${normal?}]" fi } # show chroot if exist chroot() { - if [ -n "$debian_chroot" ]; then - my_ps_chroot="${bold_cyan}$debian_chroot${normal}" + if [[ -n "$debian_chroot" ]]; then + my_ps_chroot="${bold_cyan?}$debian_chroot${normal?}" echo "($my_ps_chroot)" fi } @@ -46,11 +50,11 @@ chroot() { # show virtualenvwrapper my_ve() { - if [ -n "$CONDA_DEFAULT_ENV" ]; then - my_ps_ve="${bold_purple}${CONDA_DEFAULT_ENV}${normal}" + if [[ -n "$CONDA_DEFAULT_ENV" ]]; then + my_ps_ve="${bold_purple?}${CONDA_DEFAULT_ENV}${normal?}" echo "($my_ps_ve)" - elif [ -n "$VIRTUAL_ENV" ]; then - my_ps_ve="${bold_purple}$ve${normal}" + elif [[ -n "$VIRTUAL_ENV" ]]; then + my_ps_ve="${bold_purple?}$ve${normal?}" echo "($my_ps_ve)" fi echo "" @@ -58,12 +62,12 @@ my_ve() { prompt() { SCM_PROMPT_FORMAT='[%s][%s]' - my_ps_host="${green}\h${normal}" + my_ps_host="${green?}\h${normal?}" # yes, these are the the same for now ... - my_ps_host_root="${green}\h${normal}" + my_ps_host_root="${green?}\h${normal?}" - my_ps_user="${bold_green}\u${normal}" - my_ps_root="${bold_red}\u${normal}" + my_ps_user="${bold_green?}\u${normal?}" + my_ps_root="${bold_red?}\u${normal?}" if [ -n "$VIRTUAL_ENV" ]; then ve=$(basename "$VIRTUAL_ENV") @@ -72,11 +76,11 @@ prompt() { # nice prompt case "$(id -u)" in 0) - PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) + PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan?}\w${normal?}]$(is_vim_shell) └─▪ " ;; *) - PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) + PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan?}\w${normal?}]$(is_vim_shell) └─▪ " ;; esac