First stab at git-duet prompt segment

This commit is contained in:
Daniel Garnier-Moiroux 2020-07-08 12:23:27 +02:00
parent 0c341b6702
commit 3542212e14
5 changed files with 18 additions and 0 deletions

View File

@ -90,6 +90,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# git_duet # git duet (https://github.com/git-duet/git-duet)
# time # current time
# =========================[ Line #2 ]=========================
newline # \n
@ -1493,6 +1494,10 @@
# Custom prefix.
# typeset -g POWERLEVEL9K_TIME_PREFIX='%248Fat '
####################################[ git_duet: current author+committer ]####################################
# Current pair color
typeset -g POWERLEVEL9K_GIT_DUET_FOREGROUND=15
# Example of a user-defined prompt segment. Function prompt_example will be called on every
# prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user.

View File

@ -89,6 +89,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# git_duet # git duet (https://github.com/git-duet/git-duet)
# time # current time
# =========================[ Line #2 ]=========================
newline # \n

View File

@ -89,6 +89,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# git_duet # git duet (https://github.com/git-duet/git-duet)
# time # current time
# =========================[ Line #2 ]=========================
newline

View File

@ -90,6 +90,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# git_duet # git duet (https://github.com/git-duet/git-duet)
# time # current time
# =========================[ Line #2 ]=========================
newline

View File

@ -3958,6 +3958,16 @@ prompt_vcs() {
fi
}
################################################################
# Git-duet: Support for committer/author pair in git
# see: https://github.com/git-duet/git-duet
function prompt_git_duet() {
GIT_DUET_INITIALS=$(echo $(git config --get-regexp "^duet.env.git-.*-initials" 2>/dev/null | sed -e 's/^.*-initials //') | sed -e 's/ /+/')
if [[ ! -z "$GIT_DUET_INITIALS" ]]; then
_p9k_prompt_segment $0 magenta white '' 0 '' "$GIT_DUET_INITIALS"
fi
}
################################################################
# Vi Mode: show editing mode (NORMAL|INSERT|VISUAL)
prompt_vi_mode() {