Download:
child 3:cb307dcaf2ef
parent 1:ef4ec926e9a4
2:9c916e36d032
Anton Shestakov <engored@ya.ru>, Sun, 02 Jan 2011 17:08:25 +0800
Renamed .bashrc to .bash_prompt. Disabled any hg interaction for root.

2 файлов изменено, 49 вставок(+), 47 удалений(-) [+]
.bash_prompt file | annotate | diff | comparison | revisions
.bashrc file | annotate | diff | comparison | revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.bash_prompt Sun Jan 02 17:08:25 2011 +0800
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+function prompt_command {
+ local RETURN_CODE="$?"
+ local RESET="\[\e[0m\]"
+ local BOLD="\[\e[1m\]"
+
+ local R="\[\e[1;31m\]"
+ local G="\[\e[1;32m\]"
+ local Y="\[\e[1;33m\]"
+ local B="\[\e[1;34m\]"
+ local P="\[\e[1;35m\]"
+ local C="\[\e[1;36m\]"
+
+ local PROMPT_TEMPLATE="$P{branch|quiet}@{rev}{$R{update}}{$G+{rev|merge}}$R{status|modified}"
+
+ if [[ ${EUID} == 0 ]] ; then
+ local PROMPT_COLOR=$R
+
+ # getting hg info is disabled for root
+ local MISC_INFO=" $P-"
+ else
+ local PROMPT_COLOR=$G
+
+ # testing if current dir is a part of hg repo
+ local TEST_DIR=$PWD
+
+ while true ; do
+ [[ -d $TEST_DIR/.hg ]] && local TRACKED=1 && break
+ [[ $TEST_DIR == '/' ]] && break
+ TEST_DIR=$(dirname "$TEST_DIR")
+ done
+
+ if [[ $TRACKED ]] ; then
+ local MISC_INFO=" $(hg prompt $PROMPT_TEMPLATE)"
+ fi
+ fi
+
+ if [[ "$RETURN_CODE" != 0 ]] ; then
+ local PROMPT_PREFIX="$R${RETURN_CODE} "
+ fi
+
+ PS1="\
+${BOLD}[$G\t ${RESET}\u@\h \
+${PROMPT_PREFIX}${RESET}\W${MISC_INFO}${RESET}${BOLD}]\
+${PROMPT_COLOR}\\\$${RESET} "
+}
+
+export PROMPT_COMMAND=prompt_command
--- a/.bashrc Sat Jul 03 18:44:45 2010 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#!/bin/bash
-
-alias ls="ls --color=auto"
-
-function prompt_command {
- local RETURN_CODE="$?"
- local RESET="\[\e[0m\]"
- local BOLD="\[\e[1m\]"
-
- local R="\[\e[1;31m\]"
- local G="\[\e[1;32m\]"
- local Y="\[\e[1;33m\]"
- local B="\[\e[1;34m\]"
- local P="\[\e[1;35m\]"
- local C="\[\e[1;36m\]"
-
- local PROMPT_TEMPLATE="$P{branch|quiet}@{rev}{$R{update}}{$G+{rev|merge}}$R{status|modified}"
-
- local PROMPT_COLOR=$G
- if [[ ${EUID} == 0 ]] ; then
- PROMPT_COLOR=$R
- fi
-
- if [[ "$RETURN_CODE" != 0 ]] ; then
- local PROMPT_PREFIX="$R${RETURN_CODE} "
- fi
-
- local TEST_DIR=$PWD
-
- while true
- do
- [[ -d $TEST_DIR/.hg ]] && local TRACKED=1 && break
- [[ $TEST_DIR == '/' ]] && break
- TEST_DIR=$(dirname "$TEST_DIR")
- done
-
- if [[ $TRACKED ]] ; then
- local MISC_INFO=" $(hg prompt $PROMPT_TEMPLATE)"
- fi
-
- PS1="\
-${BOLD}[$G\t ${RESET}\u@\h \
-${PROMPT_PREFIX}${RESET}\W${MISC_INFO}${RESET}${BOLD}]\
-${PROMPT_COLOR}\\\$${RESET} "
-}
-
-export PROMPT_COMMAND=prompt_command