Guest User

Untitled

a guest
Jan 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. COLOUR_RED="\[\033[0;31m\]"
  2. COLOUR_GREEN="\[\033[0;32m\]"
  3. COLOUR_BLUE="\[\033[0;34m\]"
  4. COLOUR_NONE="\[\e[0m\]"
  5.  
  6. function git_prompt {
  7. local STATUS=`git status 2>&1`
  8. if [[ "$STATUS" == *'Not a git repository'* ]]; then
  9. echo "$"
  10. else
  11. if [[ "$STATUS" == *'working directory clean'* ]]; then
  12. echo "${COLOUR_GREEN}\[±\]${COLOUR_NONE}"
  13. else
  14. if [[ "$STATUS" == *"Changes not staged for commit:"* ]]; then
  15. echo "${COLOUR_RED}\[±\]${COLOUR_NONE}"
  16. elif [[ "$STATUS" == *"Untracked files:"* ]]; then
  17. echo "${COLOUR_RED}\[±\]${COLOUR_NONE}"
  18. else
  19. echo "${COLOUR_BLUE}\[±\]${COLOUR_NONE}"
  20. fi
  21. fi
  22. fi
  23. }
  24. export PS1='\w $(git_prompt) '
Add Comment
Please, Sign In to add comment