Download:
child 36:f3863be24d18
parent 34:6d42e8d89e7e
35:44a6ddc7f222
Anton Shestakov <engored@ya.ru>, Wed, 27 Aug 2014 14:40:49 +0900
Unlocal colors, lose double quotes where not needed.

1 файлов изменено, 20 вставок(+), 20 удалений(-) [+]
.bash_prompt file | annotate | diff | comparison | revisions
--- a/.bash_prompt Wed Aug 27 03:54:46 2014 +0900
+++ b/.bash_prompt Wed Aug 27 14:40:49 2014 +0900
@@ -1,20 +1,20 @@
#!/bin/bash
+RETURN_CODE="$?"
+RESET="\[\e[0m\]"
+BOLD="\[\e[1m\]"
+
+R="\[\e[1;31m\]"
+G="\[\e[1;32m\]"
+Y="\[\e[1;33m\]"
+B="\[\e[1;34m\]"
+P="\[\e[1;35m\]"
+C="\[\e[1;36m\]"
+
+TIME="${G}\t${RESET}"
+
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 TIME="${G}\t${RESET}"
-
- if [[ ${EUID} == 0 ]] ; then
+ if [[ $EUID == 0 ]] ; then
local PROMPT_COLOR="$R"
# getting hg and git info is disabled for root
@@ -23,7 +23,7 @@
else
local PROMPT_COLOR="$G"
- # testing if current dir is a part of hg repo
+ # testing if current dir is a part of hg/git repo
local TEST_DIR="$PWD"
while true ; do
@@ -33,7 +33,7 @@
TEST_DIR=$(dirname "$TEST_DIR")
done
- if [[ "$HG_TRACKED" ]] ; then
+ if [[ $HG_TRACKED ]] ; then
local SUM=$(LC_ALL=C hg sum 2>/dev/null)
local PARENTS=($(grep -Po '(?<=parent: ).*(?=:)' <<< "$SUM"))
local BRANCH=$(grep -Po '(?<=branch: ).*$' <<< "$SUM")
@@ -66,7 +66,7 @@
esac
local HG_INFO=" ${P}${BRANCH}☿${REV}${R}${UPDATE}${G}${MERGEREV}${R}${COMMIT}${RESET}"
fi
- if [[ "$GIT_TRACKED" ]] ; then
+ if [[ $GIT_TRACKED ]] ; then
local GIT_STATUS=$(LC_ALL=C git status 2>/dev/null)
local GIT_BRANCH=$(grep -Po '(?<=On branch ).*$' <<< "$GIT_STATUS")
@@ -84,11 +84,11 @@
fi
fi
- if [[ "$VIRTUAL_ENV" ]] ; then
+ if [[ $VIRTUAL_ENV ]] ; then
local VENV="${G}+"$(basename "$VIRTUAL_ENV")"${RESET}"
fi
- if [[ "$RETURN_CODE" != 0 ]] ; then
+ if [[ $RETURN_CODE != 0 ]] ; then
local RETCODE="${R}${RETURN_CODE}${RESET} "
fi
@@ -98,5 +98,5 @@
${PROMPT_COLOR}\\\$${RESET} "
}
-export VIRTUAL_ENV_DISABLE_PROMPT="1"
+export VIRTUAL_ENV_DISABLE_PROMPT=1
export PROMPT_COMMAND=prompt_command