Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .devcontainer/features/bash-config/config/bash-config-rc
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,25 @@ export SAVEHIST=-1
export HISTFILE=$CONFIG_FOLDER/.bash_eternal_history
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"

# bash theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
# bash theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/dst.zsh-theme
# from https://github.com/devcontainers/features/blob/main/src/common-utils/scripts/bash_theme_snippet.sh
__bash_prompt() {
local userpart='`export XIT=$? \
&& [ ! -z "${GITHUB_USER:-}" ] && echo -n "\[\033[0;32m\]@${GITHUB_USER:-} " || echo -n "\[\033[0;32m\]\u " \
&& echo -n "\u " \
&& [ "$XIT" -ne "0" ] && echo -n "\[\033[1;31m\]➜" || echo -n "\[\033[0m\]➜"`'
local gitbranch='`\
if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
export BRANCH="$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null)"; \
if [ "${BRANCH:-}" != "" ]; then \
echo -n "\[\033[0;36m\](\[\033[1;31m\]${BRANCH:-}" \
&& if [ "$(git config --get devcontainers-theme.show-dirty 2>/dev/null)" = 1 ] && \
git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
echo -n "\[\033[0;36m\](\[\033[1;32m\]${BRANCH:-}" \
&& if git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
echo -n " \[\033[1;33m\]✗"; \
fi \
&& echo -n "\[\033[0;36m\]) "; \
fi; \
fi`'
local lightblue='\[\033[1;34m\]'
fi`'
local removecolor='\[\033[0m\]'
PS1="${userpart} ${lightblue}\w ${gitbranch}${removecolor}\$ "
local lightblue='\[\033[1;34m\]'
local cyan='\[\033[0;36m\]'
PS1="${lightblue}${userpart} ${cyan}\w ${gitbranch}${removecolor}\n\$ "
unset -f __bash_prompt
}
__bash_prompt
Expand Down