romanitalian
2/15/2018 - 9:27 AM

Подсветка текущей git ветки при подключении через ssh + показывает текущее время в каждом запросе

Подсветка текущей git ветки при подключении через ssh + показывает текущее время в каждом запросе


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export GOPATH=/home/romadin/golang
export PATH="$PATH:$GOPATH/bin"


BASH_ENV=$HOME/.bashrc
export BASH_ENV 

function git-branch-name {
  git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3
}
function git-branch-prompt {
  local branch=`git-branch-name`
  if [ $branch ]; then printf " [%s]" $branch; fi
}

RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
CYAN="\[\033[0;36m\]"
PURPLE="\[\033[0;35m\]"
WHITE="\[\033[0;37m\]"
NO_COLOR="\[\033[0m\]"
# PS1=" $NO_COLOR\u@\h \$YELLOW_PROMPT\$(date +%H:%M:%S) $PURPLE\W\[\033[0m\] $GREEN\$(git-branch-prompt)\[\033[0m\] \$ $CYAN"
PS1="$YELLOW\$(date +%H:%M:%S) $PURPLE\W\[\033[0m\] $GREEN\$(git-branch-prompt)\[\033[0m\] \$ $CYAN"
# 11:37:48 my_project  [master] $