diff --git a/extensions/got.ksh b/extensions/got.ksh index d418130..da68aed 100755 --- a/extensions/got.ksh +++ b/extensions/got.ksh @@ -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 +} diff --git a/prompts/q.ksh b/prompts/q.ksh index 2a1dd18..120d66d 100755 --- a/prompts/q.ksh +++ b/prompts/q.ksh @@ -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