diff --git a/clean_files.txt b/clean_files.txt index bfc5596144..1c19acbc7c 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -41,6 +41,7 @@ themes/atomic themes/axin themes/bakke themes/barbuk +themes/base.theme.bash themes/binaryanomaly themes/bira themes/bobby @@ -74,14 +75,25 @@ themes/kitsune themes/lambda themes/liquidprompt themes/luan +themes/mairan +themes/mbriggs +themes/metal +themes/minimal themes/modern +themes/modern-t +themes/modern-time +themes/morris +themes/n0qorg +themes/newin themes/norbu +themes/nwinkler themes/oh-my-posh themes/p4helpers.theme.bash themes/pete themes/powerline themes/powerline-multiline themes/powerline-naked +themes/powerline-plain themes/pure themes/purity themes/rjorgenson diff --git a/themes/mairan/mairan.theme.bash b/themes/mairan/mairan.theme.bash index 65ef7ac1d3..2e6cec9930 100644 --- a/themes/mairan/mairan.theme.bash +++ b/themes/mairan/mairan.theme.bash @@ -1,3 +1,5 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # Mairan Bash Prompt, inspired by "Zork" if tput setaf 1 &> /dev/null; then @@ -34,11 +36,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,23 +57,25 @@ esac PS3=">> " __my_rvm_ruby_version() { - local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') + local gemset + gemset=$(echo "$GEM_HOME" | awk -F'@' '{print $2}') [ "$gemset" != "" ] && gemset="@$gemset" - local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') + local version + version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}') local full="$version$gemset" [ "$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}" + my_ps_chroot="${bold_cyan?}$debian_chroot${normal?}" echo "($my_ps_chroot)" fi } @@ -79,7 +83,7 @@ chroot() { # show virtualenvwrapper my_ve() { if [ -n "$VIRTUAL_ENV" ]; then - my_ps_ve="${bold_purple}$ve${normal}" + my_ps_ve="${bold_purple?}$ve${normal?}" echo "($my_ps_ve)" fi echo "" @@ -87,12 +91,12 @@ my_ve() { prompt() { SCM_PROMPT_FORMAT="[%s$GREEN%s]" - my_ps_host="$BOLD$ORANGE\h${normal}" + 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") @@ -101,12 +105,12 @@ prompt() { # 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}" + 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}" + 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..7ed8851b10 100644 --- a/themes/mbriggs/mbriggs.theme.bash +++ b/themes/mbriggs/mbriggs.theme.bash @@ -1,16 +1,18 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # ------------------------------------------------------------------# # 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 +20,14 @@ 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 + 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..75a4e8bae2 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 # 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,19 +62,19 @@ function virtualenv_prompt { # Rename tab function tabname { - printf "\e]1;$1\a" + printf '\e]1;%s\a' "$1" } # Rename window function winname { - printf "\e]2;$1\a" + printf '\e]2;%s\a' "$1" } # PROMPT OUTPUT =============================================================== # 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..0256ccaf6a 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 -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..9051ebcc49 100644 --- a/themes/modern-t/modern-t.theme.bash +++ b/themes/modern-t/modern-t.theme.bash @@ -1,3 +1,5 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # 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 +10,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*) @@ -26,21 +28,22 @@ esac PS3=">> " is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ]; then - echo "[${cyan}vim shell${normal}]" + if [ -n "$VIMRUNTIME" ]; then + echo "[${cyan?}vim shell${normal?}]" fi } prompt() { + local last_status=$? SCM_PROMPT_FORMAT='[%s][%s]' - if [ $? -ne 0 ]; then + if [ "$last_status" -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..0fafaba194 100644 --- a/themes/modern-time/modern-time.theme.bash +++ b/themes/modern-time/modern-time.theme.bash @@ -1,14 +1,16 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # 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 xterm*) @@ -22,8 +24,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 } @@ -33,14 +35,15 @@ modern_current_time_prompt() { prompt() { SCM_PROMPT_FORMAT='[%s][%s]' - if [ $? -ne 0 ]; then + local last_status=$? + if [ $last_status -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}$(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) + 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..55cce12f90 100644 --- a/themes/morris/morris.theme.bash +++ b/themes/morris/morris.theme.bash @@ -1,3 +1,5 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 # prompt theming # added TITLEBAR for updating the tab and window titles with the pwd @@ -18,9 +20,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..e81767386b 100644 --- a/themes/n0qorg/n0qorg.theme.bash +++ b/themes/n0qorg/n0qorg.theme.bash @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +# shellcheck disable=SC2034 # n0qorg theme by Florian Baumann ## look-a-like @@ -6,17 +7,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..8f9a052389 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 -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..b72c33e180 100644 --- a/themes/nwinkler/nwinkler.theme.bash +++ b/themes/nwinkler/nwinkler.theme.bash @@ -1,4 +1,5 @@ # shellcheck shell=bash +# shellcheck disable=SC2034 # 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/powerline-plain/powerline-plain.base.bash b/themes/powerline-plain/powerline-plain.base.bash index c077a089fc..46edcf61c9 100644 --- a/themes/powerline-plain/powerline-plain.base.bash +++ b/themes/powerline-plain/powerline-plain.base.bash @@ -1,9 +1,11 @@ +# shellcheck shell=bash . "$BASH_IT/themes/powerline/powerline.base.bash" function __powerline_left_segment { local OLD_IFS="${IFS}" IFS="|" - local params=($1) + local -a params + IFS='|' read -ra params <<< "$1" IFS="${OLD_IFS}" local pad_before_segment=" " @@ -18,11 +20,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 +41,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..2c0fd3eaa2 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 . "$BASH_IT/themes/powerline-plain/powerline-plain.base.bash"