mirror of
https://github.com/Cornelicorn/bullet-train.zsh.git
synced 2025-12-06 11:50:38 +01:00
Merge pull request #111 from dawikur/feature/custom_git_prompt
Allow settings custom git prompt
This commit is contained in:
@@ -160,6 +160,9 @@ fi
|
|||||||
if [ ! -n "${BULLETTRAIN_GIT_EXTENDED+1}" ]; then
|
if [ ! -n "${BULLETTRAIN_GIT_EXTENDED+1}" ]; then
|
||||||
BULLETTRAIN_GIT_EXTENDED=true
|
BULLETTRAIN_GIT_EXTENDED=true
|
||||||
fi
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_PROMPT_CMD+1}" ]; then
|
||||||
|
BULLETTRAIN_GIT_PROMPT_CMD="\$(git_prompt_info)"
|
||||||
|
fi
|
||||||
|
|
||||||
# HG
|
# HG
|
||||||
if [ ! -n "${BULLETTRAIN_HG_SHOW+1}" ]; then
|
if [ ! -n "${BULLETTRAIN_HG_SHOW+1}" ]; then
|
||||||
@@ -343,7 +346,7 @@ prompt_git() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local ref dirty mode repo_path
|
local ref dirty mode repo_path git_prompt
|
||||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||||
|
|
||||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||||
@@ -352,10 +355,11 @@ prompt_git() {
|
|||||||
fi
|
fi
|
||||||
prompt_segment $BULLETTRAIN_GIT_BG $BULLETTRAIN_GIT_FG
|
prompt_segment $BULLETTRAIN_GIT_BG $BULLETTRAIN_GIT_FG
|
||||||
|
|
||||||
|
eval git_prompt=${BULLETTRAIN_GIT_PROMPT_CMD}
|
||||||
if [[ $BULLETTRAIN_GIT_EXTENDED == true ]]; then
|
if [[ $BULLETTRAIN_GIT_EXTENDED == true ]]; then
|
||||||
echo -n $(git_prompt_info)$(git_prompt_status)
|
echo -n ${git_prompt}$(git_prompt_status)
|
||||||
else
|
else
|
||||||
echo -n $(git_prompt_info)
|
echo -n ${git_prompt}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user