[pitivi] pitivi-git-environment: Respect the user's __git_ps1 if present
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] pitivi-git-environment: Respect the user's __git_ps1 if present
- Date: Sun, 9 Sep 2012 17:19:23 +0000 (UTC)
commit 5c8778b0b4a3979d9e25c54d20f6cbeacee1237d
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Sat Sep 8 15:10:26 2012 -0400
pitivi-git-environment: Respect the user's __git_ps1 if present
bin/pitivi-git-environment.sh | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/bin/pitivi-git-environment.sh b/bin/pitivi-git-environment.sh
index beac32e..4a475d9 100755
--- a/bin/pitivi-git-environment.sh
+++ b/bin/pitivi-git-environment.sh
@@ -300,6 +300,21 @@ fi
if [ $ready_to_run == 1 ]; then
cd $PITIVI/pitivi
# Change the looks of the prompt, to help us remember we're in a subshell.
- changed_PS1='PS1="\[$(tput bold)$(tput setb 1)$(tput setaf 7)\]PiTiVi env:\w $ \[$(tput sgr0)\]"'
+ # If the user has some custom git bash helpers, try preserving them.
+
+ function function_exists {
+ FUNCTION_NAME=$1
+ [ -z "$FUNCTION_NAME" ] && return 1
+ declare -F "$FUNCTION_NAME" > /dev/null 2>&1
+ return $?
+ }
+ if function_exists __git_ps1
+ then
+ # Display "PTV env:", path, the output of __git_ps1, " $ "
+ changed_PS1='PS1="\[$(tput bold)$(tput setb 1)$(tput setaf 7)\]PTV env:\w\[$(tput sgr0)\]\$(__git_ps1)$ "'
+ else
+ # Display "PTV env:", path, " $ "
+ changed_PS1='PS1="\[$(tput bold)$(tput setb 1)$(tput setaf 7)\]PTV env:\w\[$(tput sgr0)\] $ "'
+ fi
bash --rcfile <(cat ~/.bashrc; echo $changed_PS1)
fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]