added check for git command presence to enable git functions in terminal fancyfying

This commit is contained in:
Bryan Joshua Pedini 2023-12-19 16:56:06 +01:00
parent d792ce8809
commit 39cb410c3e
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,7 @@
GIT_FUNCTIONS=true
command -v git &>/dev/null
if [ $? -eq 0 ]; then
GIT_FUNCTIONS=true
fi
# Spaced
#PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) "
@ -7,7 +10,7 @@ GIT_FUNCTIONS=true
# another version I really like
PS1="${PURPLE}\# ${LIGHTBLUE}{${LIGHTGREEN}\u${BROWN}@${LIGHTGREEN}\$(hostname --fqdn)${LIGHTBLUE}} ${LIGHTPURPLE}[${CYAN}\w${LIGHTPURPLE}] "
if [ $GIT_FUNCTIONS ]; then
if [ $GIT_FUNCTIONS = "true" ]; then
#PS1="$PS1${LIGHTPURPLE}[${LIGHTCYAN}$(__git_prompt)${LIGHTPURPLE}]"
PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) "
fi

View File

@ -1,11 +1,14 @@
GIT_FUNCTIONS=true
command -v git &>/dev/null
if [ $? -eq 0 ]; then
GIT_FUNCTIONS=true
fi
# Spaced
#PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) "
# Not spaced
PS1="${LIGHTBLUE}[${LIGHTRED}\u${LIGHTBLUE}@${LIGHTBROWN}$(hostname --fqdn)${LIGHTBLUE}]${LIGHTPURPLE}(${GREEN}\w${LIGHTPURPLE})"
if [ $GIT_FUNCTIONS ]; then
if [ $GIT_FUNCTIONS = "true" ]; then
#PS1="$PS1${LIGHTPURPLE}[${LIGHTCYAN}$(__git_prompt)${LIGHTPURPLE}]"
PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) "
fi