6e6310d (filesystem: New specific variable MSYS2_PS1., 2016-05-01) introduced the MSYS2_PS1 prompt script priority to allow multiple device configurations. Unfortunately, if MSYS2_PS1 was not set it overwrote the $PS1, even when specifically set by the users configuration, such as provided in the Git-for-Windows SDK (see https://github.com/git-for-windows/git/issues/794#issuecomment-227401839) and the monkey patch fix (https://github.com/git-for-windows/build-extra/pull/122). Introduce a priority order so that the user's $PS1 (if set) has an intermediate priority between the MSYS2_PS1 and the default PS1. Signed-off-by: Philip Oakley <philipoakley@iee.org>
54 lines
1.9 KiB
Plaintext
54 lines
1.9 KiB
Plaintext
# To the extent possible under law, the author(s) have dedicated all
|
|
# copyright and related and neighboring rights to this software to the
|
|
# public domain worldwide. This software is distributed without any warranty.
|
|
# You should have received a copy of the CC0 Public Domain Dedication along
|
|
# with this software.
|
|
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
|
|
# /etc/bash.bashrc: executed by bash(1) for interactive shells.
|
|
|
|
# System-wide bashrc file
|
|
|
|
# Check that we haven't already been sourced.
|
|
([[ -z ${CYG_SYS_BASHRC} ]] && CYG_SYS_BASHRC="1") || return
|
|
|
|
# If not running interactively, don't do anything
|
|
[[ "$-" != *i* ]] && return
|
|
|
|
# Warnings
|
|
unset _warning_found
|
|
for _warning_prefix in '' ${MINGW_PREFIX}; do
|
|
for _warning_file in ${_warning_prefix}/etc/profile.d/*.warning{.once,}; do
|
|
test -f "${_warning_file}" || continue
|
|
_warning="$(command sed 's/^/\t\t/' "${_warning_file}" 2>/dev/null)"
|
|
if test -n "${_warning}"; then
|
|
if test -z "${_warning_found}"; then
|
|
_warning_found='true'
|
|
echo
|
|
fi
|
|
if test -t 1
|
|
then printf "\t\e[1;33mwarning:\e[0m\n${_warning}\n\n"
|
|
else printf "\twarning:\n${_warning}\n\n"
|
|
fi
|
|
fi
|
|
[[ "${_warning_file}" = *.once ]] && rm -f "${_warning_file}"
|
|
done
|
|
done
|
|
unset _warning_found
|
|
unset _warning_prefix
|
|
unset _warning_file
|
|
unset _warning
|
|
|
|
# If MSYS2_PS1 is set, use that as default PS1;
|
|
# if a PS1 is already set, use that;
|
|
# otherwise set a default prompt
|
|
# of user@host, MSYSTEM variable, and current_directory
|
|
if test -n "${MSYS2_PS1}"
|
|
then PS1="${MSYS2_PS1}"
|
|
elif test -z "${PS1}"
|
|
then PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\$ '
|
|
fi
|
|
|
|
# Uncomment to use the terminal colours set in DIR_COLORS
|
|
# eval "$(dircolors -b /etc/DIR_COLORS)"
|