File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
.devcontainer/features/bash-config/config Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -11,4 +11,29 @@ export HISTSIZE=-1
1111export HISTFILESIZE=-1
1212export SAVEHIST=-1
1313export HISTFILE=$CONFIG_FOLDER /.bash_eternal_history
14- PROMPT_COMMAND=" history -a; $PROMPT_COMMAND "
14+
15+ # bash theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
16+ # from https://github.com/devcontainers/features/blob/main/src/common-utils/scripts/bash_theme_snippet.sh
17+ __bash_prompt () {
18+ local userpart=' `export XIT=$? \
19+ && [ ! -z "${GITHUB_USER:-}" ] && echo -n "\[\033[0;32m\]@${GITHUB_USER:-} " || echo -n "\[\033[0;32m\]\u " \
20+ && [ "$XIT" -ne "0" ] && echo -n "\[\033[1;31m\]➜" || echo -n "\[\033[0m\]➜"`'
21+ local gitbranch=' `\
22+ if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
23+ export BRANCH="$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null)"; \
24+ if [ "${BRANCH:-}" != "" ]; then \
25+ echo -n "\[\033[0;36m\](\[\033[1;31m\]${BRANCH:-}" \
26+ && if [ "$(git config --get devcontainers-theme.show-dirty 2>/dev/null)" = 1 ] && \
27+ git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
28+ echo -n " \[\033[1;33m\]✗"; \
29+ fi \
30+ && echo -n "\[\033[0;36m\]) "; \
31+ fi; \
32+ fi`'
33+ local lightblue=' \[\033[1;34m\]'
34+ local removecolor=' \[\033[0m\]'
35+ PS1=" ${userpart} ${lightblue} \w ${gitbranch}${removecolor} \$ "
36+ unset -f __bash_prompt
37+ }
38+ __bash_prompt
39+ export PROMPT_DIRTRIM=4
You can’t perform that action at this time.
0 commit comments