Skip to content

Commit 75a6964

Browse files
authored
Merge branch 'master' into hyperupcall-clean-themes-c
2 parents e5ffaaa + 0c529a1 commit 75a6964

File tree

6 files changed

+36
-23
lines changed

6 files changed

+36
-23
lines changed

clean_files.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ themes/codeword
5454
themes/cooperkid
5555
themes/cupcake
5656
themes/doubletime
57+
themes/doubletime_multiline
58+
themes/doubletime_multiline_pyonly
59+
themes/dulcie
60+
themes/duru
5761
themes/easy
5862
themes/elixr
5963
themes/essential

completion/available/aliases.completion.bash

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ function _bash-it-component-completion-callback-on-init-aliases() {
7878
# avoid recursive call loops by ignoring our own functions
7979
if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]; then
8080
compl_wrapper="_${namespace}::${alias_name}"
81+
82+
# Create a wrapper function for the alias
83+
# The use of printf on alias_arg_words is needed to ensure each element of
84+
# the array is quoted. E.X. (one two three) -> ('one' 'two' 'three')
8185
echo "function $compl_wrapper {
8286
local compl_word=\${2?}
8387
local prec_word=\${3?}
@@ -89,7 +93,7 @@ function _bash-it-component-completion-callback-on-init-aliases() {
8993
prec_word=\${prec_word#* }
9094
fi
9195
(( COMP_CWORD += ${#alias_arg_words[@]} ))
92-
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[*]}\" \"\${COMP_WORDS[@]:1}\")
96+
COMP_WORDS=(\"$alias_cmd\" $(printf "%q " "${alias_arg_words[@]}") \"\${COMP_WORDS[@]:1}\")
9397
(( COMP_POINT -= \${#COMP_LINE} ))
9498
COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
9599
(( COMP_POINT += \${#COMP_LINE} ))

themes/doubletime_multiline/doubletime_multiline.theme.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# shellcheck shell=bash
2+
# shellcheck disable=SC2034 # Expected behavior for themes.
23

34
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
45

56
function prompt_setter() {
67
# Save history
78
_save-and-reload-history 1
89
PS1="
9-
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)
10+
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}${reset_color?}] $(virtualenv_prompt)$(ruby_version_prompt)
1011
\w
1112
$(scm_prompt)$reset_color $ "
1213
PS2='> '

themes/doubletime_multiline_pyonly/doubletime_multiline_pyonly.theme.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# shellcheck shell=bash
2+
# shellcheck disable=SC2034 # Expected behavior for themes.
23

34
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
45

56
function prompt_setter() {
67
# Save history
78
_save-and-reload-history 1
89
PS1="
9-
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)
10+
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}${reset_color?}] $(virtualenv_prompt)
1011
\w
1112
$(scm_prompt)$reset_color $ "
1213
PS2='> '

themes/dulcie/dulcie.theme.bash

100755100644
Lines changed: 14 additions & 13 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 # Expected behavior for themes.
23

34
# Simplistic one-liner theme to display source control management info beside
45
# the ordinary Linux bash prompt.
@@ -25,7 +26,7 @@ dulcie_background() {
2526

2627
dulcie_prompt() {
2728
color_user_root=$(dulcie_color 169)
28-
color_user_nonroot="${green}"
29+
color_user_nonroot="${green?}"
2930
color_host_local=$(dulcie_color 230)
3031
color_host_remote=$(dulcie_color 214)
3132
color_rootdir=$(dulcie_color 117)
@@ -48,18 +49,18 @@ dulcie_prompt() {
4849
color_host="${color_host_local}"
4950
fi
5051

51-
DULCIE_USER="${color_user}\u${reset_color}"
52-
DULCIE_HOST="${color_host}\h${reset_color}"
53-
DULCIE_WORKINGDIR="${color_workingdir}\W${reset_color}"
54-
DULCIE_PROMPTCHAR="${color_user}"'\$'"${reset_color}"
52+
DULCIE_USER="${color_user?}\u${reset_color?}"
53+
DULCIE_HOST="${color_host?}\h${reset_color?}"
54+
DULCIE_WORKINGDIR="${color_workingdir?}\W${reset_color?}"
55+
DULCIE_PROMPTCHAR="${color_user?}"'\$'"${reset_color?}"
5556

56-
SCM_THEME_PROMPT_DIRTY=" ${red}${reset_color}"
57-
SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
57+
SCM_THEME_PROMPT_DIRTY=" ${red?}${reset_color}"
58+
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}${normal?}"
5859
DULCIE_SCM_BACKGROUND="${background_scm}"
5960
DULCIE_SCM_DIR_COLOR="${color_rootdir}"
6061
SCM_THEME_ROOT_SUFFIX="${reset_color}${SCM_THEME_ROOT_SUFFIX}"
61-
SCM_THEME_PROMPT_DIRTY=" $(dulcie_color 1)${reset_color}"
62-
SCM_THEME_PROMPT_CLEAN=" $(dulcie_color 10)${reset_color}"
62+
SCM_THEME_PROMPT_DIRTY=" $(dulcie_color 1)${reset_color?}"
63+
SCM_THEME_PROMPT_CLEAN=" $(dulcie_color 10)${reset_color?}"
6364
else
6465
DULCIE_USER='\u'
6566
DULCIE_HOST='\h'
@@ -79,9 +80,9 @@ dulcie_prompt() {
7980
# Open the new terminal in the same directory
8081
_is_function __vte_osc7 && __vte_osc7
8182

82-
PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color} ${DULCIE_WORKINGDIR}]"
83+
PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color?} ${DULCIE_WORKINGDIR}]"
8384
if [[ "${DULCIE_MULTILINE}" -eq "1" ]]; then
84-
PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}${reset_color} ${DULCIE_WORKINGDIR}]"
85+
PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}${reset_color?} ${DULCIE_WORKINGDIR}]"
8586
if [[ "$(scm_prompt_info)" ]]; then
8687
SCM_THEME_PROMPT_PREFIX="${DULCIE_SCM_BACKGROUND}|${DULCIE_SCM_DIR_COLOR}"
8788
SCM_THEME_PROMPT_SUFFIX="|${normal}"
@@ -90,7 +91,7 @@ dulcie_prompt() {
9091
else
9192
SCM_THEME_PROMPT_PREFIX=" ${DULCIE_SCM_BACKGROUND}|${DULCIE_SCM_DIR_COLOR}"
9293
SCM_THEME_PROMPT_SUFFIX="|${normal}"
93-
PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color} ${DULCIE_WORKINGDIR}]"
94+
PS1="${reset_color?}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color?} ${DULCIE_WORKINGDIR}]"
9495
fi
9596
PS1="${PS1}${DULCIE_PROMPTCHAR} "
9697
}

themes/duru/duru.theme.bash

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034 # Expected behavior for themes.
23

3-
SCM_THEME_PROMPT_PREFIX="${cyan} on ${green}"
4+
SCM_THEME_PROMPT_PREFIX="${cyan?} on ${green?}"
45
SCM_THEME_PROMPT_SUFFIX=""
5-
SCM_THEME_PROMPT_DIRTY=" ${red}with changes"
6+
SCM_THEME_PROMPT_DIRTY=" ${red?}with changes"
67
SCM_THEME_PROMPT_CLEAN=""
78

89
venv() {
9-
if [ ! -z "$VIRTUAL_ENV" ]; then
10+
if [ -n "$VIRTUAL_ENV" ]; then
1011
local env=$VIRTUAL_ENV
11-
echo "${gray} in ${orange}${env##*/} "
12+
echo "${gray?} in ${orange?}${env##*/} "
1213
fi
1314
}
1415

1516
last_two_dirs() {
16-
pwd | rev | awk -F / '{print $1,$2}' | rev | sed s_\ _/_ | sed "s|$(sed 's,\/,,' <<< $HOME)|~|g"
17+
# shellcheck disable=SC2001
18+
pwd | rev | awk -F / '{print $1,$2}' | rev | sed s_\ _/_ | sed "s|$(sed 's,\/,,' <<< "$HOME")|~|g"
1719
}
1820

1921
prompt() {
20-
PS1="${yellow}# ${reset_color}$(last_two_dirs)$(scm_prompt_info)${reset_color}$(venv)${reset_color} ${cyan}\n> ${reset_color}"
22+
PS1="${yellow?}# ${reset_color?}$(last_two_dirs)$(scm_prompt_info)${reset_color?}$(venv)${reset_color?} ${cyan?}\n> ${reset_color?}"
2123
}
2224

2325
safe_append_prompt_command prompt

0 commit comments

Comments
 (0)