Computer
맥 터미널 프롬프트에 git 관련 정보 출력
Gu Youn
2013. 8. 8. 17:03
아침에 트위터에서 vcprompt 관련 내용을 보고 나도 써봐야 겠다는 생각이 들어 적용하고 관련 내용 정리 함.
1. vcprompt 설치
- mac
$brew install vcprompt
- linux
https://github.com/djl/vcprompt 에서 다운로드 및 설치
2. .bash_prpfile 또는 .bashrc에 추가
export PATH=~/bin:$PATH POWDER_BLUE=$(tput setaf 153)
BRIGHT=$(tput bold)
BLINK=$(tput blink)
REVERSE=$(tput smso)
txtblk=$(tput setaf 0) # Black - Regular
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) #Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text Reset
txtbold=$(tput bold) # Bold
VCPROMPT_FORMAT="(${txtylw}%n${txtrst}:${txtcyn}%r${txtrst}@${txtgrn}%b${txtred}%m${txtpur}%u${txtrst})"
export VCPROMPT_FORMAT=$VCPROMPT_FORMAT
print_before_the_prompt () {
echo "${txtred}$USER@${txtrst}${txtbold}${txtgrn}$PWD${txtrst} $(vcprompt)"
#printf "/[${txtred}/]%s@$bldgrn%s${txtrst} %s\n" "$USER" "$PWD" "$(vcprompt)"
}
PROMPT_COMMAND=print_before_the_prompt
PS1='$' |
3. 터미널 화면
4. 참고
1. http://net.tutsplus.com/tutorials/other/how-to-customize-the-command-prompt/
2. https://github.com/djl/vcprompt
3. http://blog.outsider.ne.kr/737
