Skip to content

Commit 18f6e24

Browse files
committed
theme/norbu: shellcheck && shfmt
1 parent 95e227a commit 18f6e24

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

clean_files.txt

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ themes/command_duration.theme.bash
133133
themes/easy
134134
themes/essential
135135
themes/modern
136+
themes/norbu
136137
themes/pete
137138
themes/powerline
138139
themes/pure

themes/norbu/norbu.theme.bash

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034 # Expected behavior for themes.
23

3-
function set_prompt_symbol () {
4-
if test $1 -eq 0 ; then
5-
PROMPT_SYMBOL=">_"
6-
else
7-
PROMPT_SYMBOL="${orange}>_${normal}"
8-
fi
4+
function set_prompt_symbol() {
5+
if [[ $1 -eq 0 ]]; then
6+
prompt_symbol=">_"
7+
else
8+
prompt_symbol="${orange?}>_${normal?}"
9+
fi
910
}
11+
1012
function prompt_command() {
11-
set_prompt_symbol $?
12-
if test -z "$VIRTUAL_ENV" ; then
13-
PYTHON_VIRTUALENV=""
14-
else
15-
PYTHON_VIRTUALENV="${bold_yellow}[`basename \"$VIRTUAL_ENV\"`]"
16-
fi
13+
local ret_val="$?" prompt_symbol scm_prompt_info
14+
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
15+
PYTHON_VIRTUALENV="${bold_yellow?}[${VIRTUAL_ENV##*/}]"
16+
fi
1717

18-
PS1="${bold_orange}${PYTHON_VIRTUALENV}${reset_color}${bold_green}[\w]${bold_blue}\[$(scm_prompt_info)\]${normal} \n${PROMPT_SYMBOL} "
18+
scm_prompt_info="$(scm_prompt_info)"
19+
set_prompt_symbol "${ret_val}"
20+
PS1="${bold_orange?}${PYTHON_VIRTUALENV:-}${reset_color?}${bold_green?}[\w]${bold_blue?}[${scm_prompt_info}]${normal?} \n${prompt_symbol} "
1921
}
2022

2123
# scm themeing

0 commit comments

Comments
 (0)