shell1

Ruby code posted by bartocc
created at 30 Jun 18:52, updated at 30 Jun 18:53

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function scm_info {
  (local GIT=$(__git_ps1) && [[ -n $GIT ]]  && echo "$GIT") || (local SVN=$(svn_rev) && [[ -n $SVN ]] && echo "$SVN")
}

function setPrompt {
  RED=$(tput setaf 1)
  GREEN=$(tput setaf 2)
  YELLOW=$(tput setaf 3)
  CYAN=$(tput setaf 6)
  NORM=$(tput sgr0)
  BOLD=$(tput bold)

  PS1='\[$BOLD\]\[$RED\][\[$CYAN\]\u\[$RED\]@\[$CYAN\]\h\[$RED\]] \[$YELLOW\]\w\[$(scm_color)\]$(scm_info) \[$NORM\]\[$GREEN\]\$ \[$NORM\]'
}

setPrompt
464 Bytes in 11 ms with coderay