diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2016-11-10 07:36:03 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2016-11-10 07:36:03 +0100 |
| commit | 1e2135f0b2ceb9ee95247fc61bad9632a9d47888 (patch) | |
| tree | fe585c2a0d2d3dad89a173dfc9eb00f94657f273 | |
| parent | 18259e0e96d9373341dd8157ae397e1910d80166 (diff) | |
| download | dotfiles-1e2135f0b2ceb9ee95247fc61bad9632a9d47888.tar.xz | |
Check for git-sh-prompt availability
| -rw-r--r-- | .bashprompt | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/.bashprompt b/.bashprompt index 96f92eb..062dd26 100644 --- a/.bashprompt +++ b/.bashprompt @@ -18,6 +18,11 @@ __show-hostname () esac } +__have-gitprompt () +{ + [ -f /usr/lib/git-core/git-sh-prompt ] +} + __set-title () { local title @@ -124,7 +129,12 @@ __set-prompt () PS1+=$(__fontify : dim) PS1+=$(__fontify '\w' bold blue) - PS1+=$(__fontify "$(__git_ps1 '(%s)')" red) + + if [ ${PS1_SHOWGITSTATUS} ] + then + PS1+=$(__fontify "$(__git_ps1 '(%s)')" red) + fi + PS1+=$(__fontify '\$' dim) PS1+=' ' @@ -170,8 +180,13 @@ __refresh-terminal () } -. /usr/lib/git-core/git-sh-prompt -GIT_PS1_SHOWDIRTYSTATE=t -GIT_PS1_SHOWUPSTREAM=auto +if __have-gitprompt +then + . /usr/lib/git-core/git-sh-prompt + GIT_PS1_SHOWDIRTYSTATE=t + GIT_PS1_SHOWUPSTREAM=auto + + PS1_SHOWGITSTATUS=t +fi export PROMPT_COMMAND=__refresh-terminal |
