Use one function for parsing SCM branch
This commit is contained in:
parent
6c940da91b
commit
342af2237b
2 changed files with 4 additions and 7 deletions
2
.bashrc
2
.bashrc
|
@ -14,7 +14,7 @@ source ~/.aliases
|
|||
source ~/.bashcolors
|
||||
source ~/.functions
|
||||
|
||||
export PS1="${Yellow}\d \A ${Off}${Cyan}\u@\h: ${Off}\w ${Green}\$(parse_git_branch)${BPurple}\$(parse_fossil_branch)${Off}\n-$ "
|
||||
export PS1="${Yellow}\d \A ${Off}${Cyan}\u@\h: ${Off}\w ${Green}\$(parse_branch git)${BPurple}\$(parse_branch fossil)${Off}\n-$ "
|
||||
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
export PYTHONUSERBASE=~/.env/python
|
||||
|
|
|
@ -2,12 +2,9 @@
|
|||
|
||||
iploc () { curl -s http://ip-api.com/json/"$1"|tr , '\n'|sed 's/[\"{}]//g'; }
|
||||
|
||||
function parse_git_branch () {
|
||||
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
|
||||
}
|
||||
|
||||
function parse_fossil_branch () {
|
||||
fossil branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
|
||||
function parse_branch {
|
||||
scmexe=${1:-git}
|
||||
$scmexe branch 2> /dev/null | awk '/^*/{print "("$2")"}'
|
||||
}
|
||||
|
||||
yell() { echo "$0: $*" >&2; }
|
||||
|
|
Loading…
Add table
Reference in a new issue