Add basic PS1 support for got.

This commit is contained in:
Aaron Bieber 2020-08-16 13:58:33 +00:00
parent c127e14d46
commit 4cbf7e178d
2 changed files with 11 additions and 1 deletions

View File

@ -16,3 +16,12 @@ function got-push {
(cd "$r" && git push "$@")
}
function __got_ps1 {
local _format _branch _status
_format=$1
_branch=$(got branch 2>/dev/null | grep -v conf_set_now)
_status=$?
if [ $_status == 0 ]; then
printf "$_format" $_branch
fi
}

View File

@ -1,5 +1,6 @@
load_extension git-prompt
load_extension got
PS1='\u@\h[\[\e[01;$(($??31:39))m\]$?\[\e[0m]\]:\w\]$(__git_ps1 " (%s)")\$ '
PS1='\u@\h[\[\e[01;$(($??31:39))m\]$?\[\e[0m]\]:\w\]$(__got_ps1 " got:(%s)")$(__git_ps1 " git:(%s)")\$ '
export PS1