From 39cb410c3e626cf35da029314380b9f51c68e855 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Tue, 19 Dec 2023 16:56:06 +0100 Subject: [PATCH] added check for git command presence to enable git functions in terminal fancyfying --- bashrc_overrides/terminal_fancyfying_client | 7 +++++-- bashrc_overrides/terminal_fancyfying_server | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bashrc_overrides/terminal_fancyfying_client b/bashrc_overrides/terminal_fancyfying_client index 8d27259..5ff6469 100644 --- a/bashrc_overrides/terminal_fancyfying_client +++ b/bashrc_overrides/terminal_fancyfying_client @@ -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 diff --git a/bashrc_overrides/terminal_fancyfying_server b/bashrc_overrides/terminal_fancyfying_server index 9f202da..e9264ce 100644 --- a/bashrc_overrides/terminal_fancyfying_server +++ b/bashrc_overrides/terminal_fancyfying_server @@ -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