Guest User

Untitled

a guest
Jan 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. alias be="bundle exec"
  2. alias ber="bundle exec rspec spec --color"
  3. alias bec="bundle exec cucumber --color"
  4. export CLI_COLOR=
  5.  
  6.  
  7. function default_prompt {
  8. echo "$"
  9. }
  10.  
  11. function red_git_prompt {
  12. echo -e '\033[0;31m±\033[m'
  13. }
  14.  
  15. function green_git_prompt {
  16. echo -e '\033[0;32m±\033[m'
  17. }
  18.  
  19. function blue_git_prompt {
  20. echo -e '\033[0;34m±\033[m'
  21. }
  22.  
  23. function git_prompt {
  24. local STATUS=`git status 2>&1`
  25. if [[ "$STATUS" == *'Not a git repository'* ]]; then
  26. default_prompt
  27. else
  28. if [[ "$STATUS" == *'working directory clean'* ]]; then
  29. green_git_prompt
  30. else
  31. if [[ "$STATUS" == *"Changes not staged for commit:"* ]]; then
  32. red_git_prompt
  33. elif [[ "$STATUS" == *"Untracked files:"* ]]; then
  34. red_git_prompt
  35. else
  36. blue_git_prompt
  37. fi
  38. fi
  39. fi
  40. }
  41.  
  42. function process_list {
  43. local PROCESSES=`jobs -p | xargs -I {} ps {} -o "comm= pid=" | xargs -I {} echo -n "({})"`
  44. if [[ "$PROCESSES" != "" ]]
  45. then
  46. echo $PROCESSES
  47. echo "\n"
  48. fi
  49. }
  50.  
  51. export PS1='$(process_list)\w $(git_prompt) '
Add Comment
Please, Sign In to add comment