Skip to content

Commit dd53b0a

Browse files
seefoodclaude
andcommitted
Clean up 5 theme files and expand linting coverage
• Fix color variable references using ${var?} pattern for fail-fast behavior • Resolve SC2155 variable declaration/assignment separation issues • Fix SC2181 exit code checking and SC2059 printf format issues • Add themes/base.theme.bash, themes/mairan, themes/mbriggs, themes/metal, themes/minimal, themes/modern-t to clean_files.txt • All themes now pass shellcheck, shfmt, and bash-it requirements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a9f7b45 commit dd53b0a

6 files changed

Lines changed: 74 additions & 54 deletions

File tree

clean_files.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ themes/atomic
4141
themes/axin
4242
themes/bakke
4343
themes/barbuk
44+
themes/base.theme.bash
4445
themes/binaryanomaly
4546
themes/bira
4647
themes/bobby
@@ -74,7 +75,12 @@ themes/kitsune
7475
themes/lambda
7576
themes/liquidprompt
7677
themes/luan
78+
themes/mairan
79+
themes/mbriggs
80+
themes/metal
81+
themes/minimal
7782
themes/modern
83+
themes/modern-t
7884
themes/norbu
7985
themes/oh-my-posh
8086
themes/p4helpers.theme.bash

themes/mairan/mairan.theme.bash

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034
13
# Mairan Bash Prompt, inspired by "Zork"
24

35
if tput setaf 1 &> /dev/null; then
@@ -34,11 +36,11 @@ BRACKET_COLOR=$ORANGE
3436
SCM_THEME_PROMPT_PREFIX=""
3537
SCM_THEME_PROMPT_SUFFIX=""
3638

37-
SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}"
38-
SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
39-
SCM_GIT_CHAR="${bold_green}±${normal}"
40-
SCM_SVN_CHAR="${bold_cyan}${normal}"
41-
SCM_HG_CHAR="${bold_red}${normal}"
39+
SCM_THEME_PROMPT_DIRTY=" ${bold_red?}${normal?}"
40+
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}${normal?}"
41+
SCM_GIT_CHAR="${bold_green?}±${normal?}"
42+
SCM_SVN_CHAR="${bold_cyan?}${normal?}"
43+
SCM_HG_CHAR="${bold_red?}${normal?}"
4244

4345
#Mysql Prompt
4446
export MYSQL_PS1="(\u@\h) [\d]> "
@@ -55,44 +57,46 @@ esac
5557
PS3=">> "
5658

5759
__my_rvm_ruby_version() {
58-
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
60+
local gemset
61+
gemset=$(echo "$GEM_HOME" | awk -F'@' '{print $2}')
5962
[ "$gemset" != "" ] && gemset="@$gemset"
60-
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
63+
local version
64+
version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}')
6165
local full="$version$gemset"
6266
[ "$full" != "" ] && echo "[$full]"
6367
}
6468

6569
is_vim_shell() {
66-
if [ ! -z "$VIMRUNTIME" ]; then
67-
echo "[${cyan}vim shell${normal}]"
70+
if [ -n "$VIMRUNTIME" ]; then
71+
echo "[${cyan?}vim shell${normal?}]"
6872
fi
6973
}
7074

7175
# show chroot if exist
7276
chroot() {
7377
if [ -n "$debian_chroot" ]; then
74-
my_ps_chroot="${bold_cyan}$debian_chroot${normal}"
78+
my_ps_chroot="${bold_cyan?}$debian_chroot${normal?}"
7579
echo "($my_ps_chroot)"
7680
fi
7781
}
7882

7983
# show virtualenvwrapper
8084
my_ve() {
8185
if [ -n "$VIRTUAL_ENV" ]; then
82-
my_ps_ve="${bold_purple}$ve${normal}"
86+
my_ps_ve="${bold_purple?}$ve${normal?}"
8387
echo "($my_ps_ve)"
8488
fi
8589
echo ""
8690
}
8791

8892
prompt() {
8993
SCM_PROMPT_FORMAT="[%s$GREEN%s]"
90-
my_ps_host="$BOLD$ORANGE\h${normal}"
94+
my_ps_host="$BOLD$ORANGE\h${normal?}"
9195
# yes, these are the the same for now ...
92-
my_ps_host_root="$ORANGE\h${normal}"
96+
my_ps_host_root="$ORANGE\h${normal?}"
9397

94-
my_ps_user="$BOLD$GREEN\u${normal}"
95-
my_ps_root="${bold_red}\u${normal}"
98+
my_ps_user="$BOLD$GREEN\u${normal?}"
99+
my_ps_root="${bold_red?}\u${normal?}"
96100

97101
if [ -n "$VIRTUAL_ENV" ]; then
98102
ve=$(basename "$VIRTUAL_ENV")
@@ -101,12 +105,12 @@ prompt() {
101105
# nice prompt
102106
case "$(id -u)" in
103107
0)
104-
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}
105-
└─▪ ${prompt_symbol} ${normal}"
108+
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}
109+
└─▪ ${prompt_symbol} ${normal?}"
106110
;;
107111
*)
108-
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}
109-
└─▪ ${prompt_symbol} ${normal}"
112+
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}
113+
└─▪ ${prompt_symbol} ${normal?}"
110114
;;
111115
esac
112116
}

themes/mbriggs/mbriggs.theme.bash

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034
13
# ------------------------------------------------------------------#
24
# FILE: mbriggs.zsh-theme #
35
# BY: Matt Briggs (matt@mattbriggs.net) #
46
# BASED ON: smt by Stephen Tudor (stephen@tudorstudio.com) #
57
# ------------------------------------------------------------------#
68

7-
SCM_THEME_PROMPT_DIRTY="${red}${reset_color}"
8-
SCM_THEME_PROMPT_AHEAD="${red}!${reset_color}"
9-
SCM_THEME_PROMPT_CLEAN="${green}${reset_color}"
9+
SCM_THEME_PROMPT_DIRTY="${red?}${reset_color?}"
10+
SCM_THEME_PROMPT_AHEAD="${red?}!${reset_color?}"
11+
SCM_THEME_PROMPT_CLEAN="${green?}${reset_color?}"
1012
SCM_THEME_PROMPT_PREFIX=" "
1113
SCM_THEME_PROMPT_SUFFIX=""
12-
GIT_SHA_PREFIX=" ${yellow}"
13-
GIT_SHA_SUFFIX="${reset_color}"
14+
GIT_SHA_PREFIX=" ${yellow?}"
15+
GIT_SHA_SUFFIX="${reset_color?}"
1416

1517
function git_short_sha() {
1618
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
1719
}
1820

1921
function prompt() {
2022
local return_status=""
21-
local ruby="${red}$(ruby_version_prompt)${reset_color}"
22-
local user_host="${green}\h${reset_color}"
23+
local ruby
24+
ruby="${red?}$(ruby_version_prompt)${reset_color?}"
25+
local user_host
26+
user_host="${green?}\h${reset_color?}"
2327
local current_path="\w"
2428
local n_commands="\!"
25-
local git_branch="$(git_short_sha)$(scm_prompt_info)"
29+
local git_branch
30+
git_branch="$(git_short_sha)$(scm_prompt_info)"
2631
local prompt_symbol='λ'
2732
local open='('
2833
local close=')'

themes/metal/metal.theme.bash

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034
23

34
# Emoji-based theme to display source control management and
45
# virtual environment info beside the ordinary bash prompt.
@@ -21,20 +22,20 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=""
2122
# SCM prompts
2223
SCM_NONE_CHAR=""
2324
SCM_GIT_CHAR="[±] "
24-
SCM_GIT_BEHIND_CHAR="${red}${normal}"
25-
SCM_GIT_AHEAD_CHAR="${bold_green}${normal}"
25+
SCM_GIT_BEHIND_CHAR="${red?}${normal?}"
26+
SCM_GIT_AHEAD_CHAR="${bold_green?}${normal?}"
2627
SCM_GIT_UNTRACKED_CHAR=""
27-
SCM_GIT_UNSTAGED_CHAR="${bold_yellow}${normal}"
28-
SCM_GIT_STAGED_CHAR="${bold_green}+${normal}"
28+
SCM_GIT_UNSTAGED_CHAR="${bold_yellow?}${normal?}"
29+
SCM_GIT_STAGED_CHAR="${bold_green?}+${normal?}"
2930

3031
SCM_THEME_PROMPT_DIRTY=""
3132
SCM_THEME_PROMPT_CLEAN=""
3233
SCM_THEME_PROMPT_PREFIX=""
3334
SCM_THEME_PROMPT_SUFFIX=""
3435

3536
# Git status prompts
36-
GIT_THEME_PROMPT_DIRTY=" ${red}${normal}"
37-
GIT_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
37+
GIT_THEME_PROMPT_DIRTY=" ${red?}${normal?}"
38+
GIT_THEME_PROMPT_CLEAN=" ${bold_green?}${normal?}"
3839
GIT_THEME_PROMPT_PREFIX=""
3940
GIT_THEME_PROMPT_SUFFIX=""
4041

@@ -61,19 +62,19 @@ function virtualenv_prompt {
6162

6263
# Rename tab
6364
function tabname {
64-
printf "\e]1;$1\a"
65+
printf '\e]1;%s\a' "$1"
6566
}
6667

6768
# Rename window
6869
function winname {
69-
printf "\e]2;$1\a"
70+
printf '\e]2;%s\a' "$1"
7071
}
7172

7273
# PROMPT OUTPUT ===============================================================
7374

7475
# Displays the current prompt
7576
function prompt_command() {
76-
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}"
77+
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}"
7778
PS2="${icon_end}"
7879
}
7980

themes/minimal/minimal.theme.bash

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034
23

3-
SCM_THEME_PROMPT_PREFIX="${cyan}(${green}"
4-
SCM_THEME_PROMPT_SUFFIX="${cyan})"
5-
SCM_THEME_PROMPT_DIRTY=" ${red}"
6-
SCM_THEME_PROMPT_CLEAN=" ${green}"
4+
SCM_THEME_PROMPT_PREFIX="${cyan?}(${green?}"
5+
SCM_THEME_PROMPT_SUFFIX="${cyan?})"
6+
SCM_THEME_PROMPT_DIRTY=" ${red?}"
7+
SCM_THEME_PROMPT_CLEAN=" ${green?}"
78

89
prompt() {
9-
PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} "
10+
PS1="$(scm_prompt_info)${reset_color?} ${cyan?}\W${reset_color?} "
1011
}
1112

1213
safe_append_prompt_command prompt

themes/modern-t/modern-t.theme.bash

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034
13
# The "modern-t" theme is a "modern" theme variant with support
24
# for "t", the minimalist python todo list utility by Steve Losh.
35
# Get and install "t" at https://github.com/sjl/t#installing-t
@@ -8,11 +10,11 @@
810
SCM_THEME_PROMPT_PREFIX=""
911
SCM_THEME_PROMPT_SUFFIX=""
1012

11-
SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}"
12-
SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
13-
SCM_GIT_CHAR="${bold_green}±${normal}"
14-
SCM_SVN_CHAR="${bold_cyan}${normal}"
15-
SCM_HG_CHAR="${bold_red}${normal}"
13+
SCM_THEME_PROMPT_DIRTY=" ${bold_red?}${normal?}"
14+
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}${normal?}"
15+
SCM_GIT_CHAR="${bold_green?}±${normal?}"
16+
SCM_SVN_CHAR="${bold_cyan?}${normal?}"
17+
SCM_HG_CHAR="${bold_red?}${normal?}"
1618

1719
case $TERM in
1820
xterm*)
@@ -26,21 +28,22 @@ esac
2628
PS3=">> "
2729

2830
is_vim_shell() {
29-
if [ ! -z "$VIMRUNTIME" ]; then
30-
echo "[${cyan}vim shell${normal}]"
31+
if [ -n "$VIMRUNTIME" ]; then
32+
echo "[${cyan?}vim shell${normal?}]"
3133
fi
3234
}
3335

3436
prompt() {
37+
local last_status=$?
3538
SCM_PROMPT_FORMAT='[%s][%s]'
36-
if [ $? -ne 0 ]; then
39+
if [ $last_status -ne 0 ]; then
3740
# Yes, the indenting on these is weird, but it has to be like
3841
# this otherwise it won't display properly.
3942

40-
PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
41-
${bold_red}└─▪${normal} "
43+
PS1="${TITLEBAR}${bold_red?}┌─[${cyan?}$(t | wc -l | sed -e's/ *//')${reset_color?}]${reset_color?}$(scm_prompt)[${cyan?}\W${normal?}]$(is_vim_shell)
44+
${bold_red?}└─▪${normal?} "
4245
else
43-
PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
46+
PS1="${TITLEBAR}┌─[${cyan?}$(t | wc -l | sed -e's/ *//')${reset_color?}]$(scm_prompt)[${cyan?}\W${normal?}]$(is_vim_shell)
4447
└─▪ "
4548
fi
4649
}

0 commit comments

Comments
 (0)