0
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-09-19 04:01:21 +02:00

Add bzr and aws profile theme support

This commit is contained in:
Stephen Gelman 2024-06-13 19:54:08 -05:00
parent fbccfe80fd
commit 97a28fcaf7

View file

@ -57,6 +57,12 @@ esac
: ${AGNOSTER_GIT_DIRTY_FG:=black} : ${AGNOSTER_GIT_DIRTY_FG:=black}
: ${AGNOSTER_GIT_DIRTY_BG:=yellow} : ${AGNOSTER_GIT_DIRTY_BG:=yellow}
# Bazaar related
: ${AGNOSTER_BZR_CLEAN_FG:=${CURRENT_FG}}
: ${AGNOSTER_BZR_CLEAN_BG:=green}
: ${AGNOSTER_BZR_DIRTY_FG:=black}
: ${AGNOSTER_BZR_DIRTY_BG:=yellow}
# Mercurial related # Mercurial related
: ${AGNOSTER_HG_NEWFILE_FG:=white} : ${AGNOSTER_HG_NEWFILE_FG:=white}
: ${AGNOSTER_HG_NEWFILE_BG:=red} : ${AGNOSTER_HG_NEWFILE_BG:=red}
@ -69,6 +75,12 @@ esac
: ${AGNOSTER_VENV_FG:=black} : ${AGNOSTER_VENV_FG:=black}
: ${AGNOSTER_VENV_BG:=blue} : ${AGNOSTER_VENV_BG:=blue}
# AWS Profile colors
: ${AGNOSTER_AWS_PROD_FG:=yellow}
: ${AGNOSTER_AWS_PROD_BG:=red}
: ${AGNOSTER_AWS_FG:=black}
: ${AGNOSTER_AWS_BG:=green}
# Status symbols # Status symbols
: ${AGNOSTER_STATUS_RETVAL_FG:=red} : ${AGNOSTER_STATUS_RETVAL_FG:=red}
: ${AGNOSTER_STATUS_ROOT_FG:=yellow} : ${AGNOSTER_STATUS_ROOT_FG:=yellow}
@ -236,12 +248,12 @@ prompt_bzr() {
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m) status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%} revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
if [[ $status_mod -gt 0 ]] ; then if [[ $status_mod -gt 0 ]] ; then
prompt_segment yellow black "bzr@$revision ✚" prompt_segment "$AGNOSTER_BZR_DIRTY_BG" "$AGNOSTER_BZR_DIRTY_FG" "bzr@$revision ✚"
else else
if [[ $status_all -gt 0 ]] ; then if [[ $status_all -gt 0 ]] ; then
prompt_segment yellow black "bzr@$revision" prompt_segment "$AGNOSTER_BZR_DIRTY_BG" "$AGNOSTER_BZR_DIRTY_FG" "bzr@$revision"
else else
prompt_segment green black "bzr@$revision" prompt_segment "$AGNOSTER_BZR_CLEAN_BG" "$AGNOSTER_BZR_CLEAN_FG" "bzr@$revision"
fi fi
fi fi
fi fi
@ -326,8 +338,8 @@ prompt_status() {
prompt_aws() { prompt_aws() {
[[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return [[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
case "$AWS_PROFILE" in case "$AWS_PROFILE" in
*-prod|*production*) prompt_segment red yellow "AWS: ${AWS_PROFILE:gs/%/%%}" ;; *-prod|*production*) prompt_segment "$AGNOSTER_AWS_PROD_BG" "$AGNOSTER_AWS_PROD_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
*) prompt_segment green black "AWS: ${AWS_PROFILE:gs/%/%%}" ;; *) prompt_segment "$AGNOSTER_AWS_BG" "$AGNOSTER_AWS_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
esac esac
} }