install_tools_bash_git_prompt.sh 741 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # bash-git-prompt
  7. application=bash-git-prompt
  8. repository=https://github.com/magicmonty/bash-git-prompt.git
  9. mkdir -p ~/src
  10. cd ~/src || return
  11. if [ ! -d $application ]; then
  12. git clone $repository
  13. cd $application || return
  14. else
  15. cd $application || return
  16. git pull
  17. fi
  18. {
  19. echo ""
  20. echo "# bash git prompt"
  21. echo "if [ -f ~/src/bash-git-prompt/gitprompt.sh ]; then"
  22. echo " # To only show the git prompt in or under a repository directory"
  23. echo " GIT_PROMPT_ONLY_IN_REPO=1"
  24. echo " # To use upstream's default theme"
  25. echo " GIT_PROMPT_THEME=Default"
  26. echo " source ~/src/bash-git-prompt/gitprompt.sh"
  27. echo "fi"
  28. }>>~/.bashrc
  29. source ~/.bashrc