mirror of
https://github.com/meineerde/dotfiles.git
synced 2026-03-23 17:19:53 +00:00
Further simplify prompt_vcs
This commit is contained in:
parent
05cb36709a
commit
dc43aa9130
23
.bashrc
23
.bashrc
@ -280,31 +280,20 @@ esac
|
|||||||
ps1_host='\h'
|
ps1_host='\h'
|
||||||
|
|
||||||
__prompt_vcs() {
|
__prompt_vcs() {
|
||||||
if [[ -z $NOPROMPT ]]; then
|
if [[ -z "$NOPROMPT" ]]; then
|
||||||
local vcs base_dir ref base_dir
|
git_ref() {
|
||||||
|
|
||||||
git_dir() {
|
|
||||||
ref=$(echo -e "$(__git_ps1 "(%s)")")
|
ref=$(echo -e "$(__git_ps1 "(%s)")")
|
||||||
if [ -z "$ref" ]; then return 1; fi
|
if [ -z "$ref" ]; then return 1; fi
|
||||||
vcs="git"
|
echo "$ref"
|
||||||
}
|
}
|
||||||
|
|
||||||
svn_dir() {
|
svn_ref() {
|
||||||
[ -d ".svn" ] || return 1
|
[ -d ".svn" ] || return 1
|
||||||
ref=$(svn info | awk '/^URL/ { sub(".*/","",$0); r=$0 } /^Revision/ { sub("[^0-9]*","",$0); print $0 }')
|
ref=$(svn info | awk '/^URL/ { sub(".*/","",$0); r=$0 } /^Revision/ { sub("[^0-9]*","",$0); print $0 }')
|
||||||
ref="[$ref]"
|
echo "[$ref]"
|
||||||
vcs="svn"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
git_dir || svn_dir
|
git_ref || svn_ref
|
||||||
|
|
||||||
if [ -n "$vcs" ]; then
|
|
||||||
alias st="$vcs status"
|
|
||||||
alias d="$vcs diff"
|
|
||||||
|
|
||||||
__vcs_ref="$ref"
|
|
||||||
echo " $__vcs_ref"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
ps1_vcs='$(__prompt_vcs)'
|
ps1_vcs='$(__prompt_vcs)'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user