Allow to disable git/svn/mercurial features
New variables in liquidpromptrc for that
This commit is contained in:
parent
78b9aff683
commit
36954546d7
21
liquidprompt
21
liquidprompt
@ -218,6 +218,9 @@ LP_PROXY_MARK=${LP_PROXY_MARK:-"↥"}
|
|||||||
LP_GIT_MARK=${LP_GIT_MARK:-"±"}
|
LP_GIT_MARK=${LP_GIT_MARK:-"±"}
|
||||||
LP_MERCURIAL_MARK=${LP_MERCURIAL_MARK:-"☿"}
|
LP_MERCURIAL_MARK=${LP_MERCURIAL_MARK:-"☿"}
|
||||||
LP_SUBVERSION_MARK=${LP_SUBVERSION_MARK:-"‡"}
|
LP_SUBVERSION_MARK=${LP_SUBVERSION_MARK:-"‡"}
|
||||||
|
LP_ENABLE_GIT=${LP_ENABLE_GIT:-1}
|
||||||
|
LP_ENABLE_SVN=${LP_ENABLE_SVN:-1}
|
||||||
|
LP_ENABLE_MERCURIAL=${LP_ENABLE_MERCURIAL:-1}
|
||||||
|
|
||||||
LP_COLOR_PATH=${LP_COLOR_PATH:-$BOLD_WHITE}
|
LP_COLOR_PATH=${LP_COLOR_PATH:-$BOLD_WHITE}
|
||||||
LP_COLOR_PATH_ROOT=${LP_COLOR_PATH_ROOT:-$BOLD_YELLOW}
|
LP_COLOR_PATH_ROOT=${LP_COLOR_PATH_ROOT:-$BOLD_YELLOW}
|
||||||
@ -543,6 +546,9 @@ _lp_return_value()
|
|||||||
# Get the branch name of the current directory
|
# Get the branch name of the current directory
|
||||||
_lp_git_branch()
|
_lp_git_branch()
|
||||||
{
|
{
|
||||||
|
if [[ $LP_ENABLE_GIT == 0 ]] ; then
|
||||||
|
return ""
|
||||||
|
fi
|
||||||
if git rev-parse --git-dir >/dev/null 2>&1 && [[ ! -z "$(git branch)" ]] ; then
|
if git rev-parse --git-dir >/dev/null 2>&1 && [[ ! -z "$(git branch)" ]] ; then
|
||||||
echo -n "$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p;')"
|
echo -n "$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p;')"
|
||||||
fi
|
fi
|
||||||
@ -556,6 +562,9 @@ _lp_git_branch()
|
|||||||
# Add the number of pending commits and the impacted lines.
|
# Add the number of pending commits and the impacted lines.
|
||||||
_lp_git_branch_color()
|
_lp_git_branch_color()
|
||||||
{
|
{
|
||||||
|
if [[ $LP_ENABLE_GIT == 0 ]] ; then
|
||||||
|
return ""
|
||||||
|
fi
|
||||||
command -v git >/dev/null 2>&1 || return 1;
|
command -v git >/dev/null 2>&1 || return 1;
|
||||||
local branch
|
local branch
|
||||||
branch=$(_lp_git_branch)
|
branch=$(_lp_git_branch)
|
||||||
@ -601,6 +610,9 @@ _lp_git_branch_color()
|
|||||||
# Get the branch name of the current directory
|
# Get the branch name of the current directory
|
||||||
_lp_hg_branch()
|
_lp_hg_branch()
|
||||||
{
|
{
|
||||||
|
if [[ $LP_ENABLE_MERCURIAL == 0 ]] ; then
|
||||||
|
return ""
|
||||||
|
fi
|
||||||
local branch
|
local branch
|
||||||
branch="$(hg branch 2>/dev/null)"
|
branch="$(hg branch 2>/dev/null)"
|
||||||
if [[ $? -eq 0 ]] && [[ ! -z "$(hg branch)" ]] ; then
|
if [[ $? -eq 0 ]] && [[ ! -z "$(hg branch)" ]] ; then
|
||||||
@ -614,6 +626,9 @@ _lp_hg_branch()
|
|||||||
# - TODO: yellow if there is some commits not pushed
|
# - TODO: yellow if there is some commits not pushed
|
||||||
_lp_hg_branch_color()
|
_lp_hg_branch_color()
|
||||||
{
|
{
|
||||||
|
if [[ $LP_ENABLE_MERCURIAL == 0 ]] ; then
|
||||||
|
return ""
|
||||||
|
fi
|
||||||
command -v hg >/dev/null 2>&1 || return 1;
|
command -v hg >/dev/null 2>&1 || return 1;
|
||||||
local branch
|
local branch
|
||||||
local ret
|
local ret
|
||||||
@ -634,6 +649,9 @@ _lp_hg_branch_color()
|
|||||||
# For the first level of the repository, gives the repository name
|
# For the first level of the repository, gives the repository name
|
||||||
_lp_svn_branch()
|
_lp_svn_branch()
|
||||||
{
|
{
|
||||||
|
if [[ $LP_ENABLE_SVN == 0 ]] ; then
|
||||||
|
return ""
|
||||||
|
fi
|
||||||
local infos
|
local infos
|
||||||
local ret
|
local ret
|
||||||
infos=$(svn info --xml 2>/dev/null)
|
infos=$(svn info --xml 2>/dev/null)
|
||||||
@ -660,6 +678,9 @@ _lp_svn_branch()
|
|||||||
# informations are only displayed for the CURRENT directory.
|
# informations are only displayed for the CURRENT directory.
|
||||||
_lp_svn_branch_color()
|
_lp_svn_branch_color()
|
||||||
{
|
{
|
||||||
|
if [[ $LP_ENABLE_SVN == 0 ]] ; then
|
||||||
|
return ""
|
||||||
|
fi
|
||||||
command -v svn >/dev/null 2>&1 || return 1;
|
command -v svn >/dev/null 2>&1 || return 1;
|
||||||
local branch
|
local branch
|
||||||
branch=$(_lp_svn_branch)
|
branch=$(_lp_svn_branch)
|
||||||
|
@ -28,4 +28,16 @@ LP_PATH_KEEP=2
|
|||||||
# set to 1 if you want to always see the hostname
|
# set to 1 if you want to always see the hostname
|
||||||
LP_HOSTNAME_ALWAYS=0
|
LP_HOSTNAME_ALWAYS=0
|
||||||
|
|
||||||
|
# Do you want to use the git special features ?
|
||||||
|
# Recommended value is 1
|
||||||
|
LP_ENABLE_GIT=1
|
||||||
|
|
||||||
|
# Do you want to use the svn special features ?
|
||||||
|
# Recommended value is 1
|
||||||
|
LP_ENABLE_SVN=1
|
||||||
|
|
||||||
|
# Do you want to use the mercurial special features ?
|
||||||
|
# Recommended value is 1
|
||||||
|
LP_ENABLE_MERCURIAL=1
|
||||||
|
|
||||||
# vim: set et sts=4 sw=4 tw=120 ft=sh:
|
# vim: set et sts=4 sw=4 tw=120 ft=sh:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user