Add auto-completion for git-ps command

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-09-28 15:49:44 +02:00
parent 82f778ccf4
commit 2cea257954
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D

14
.zsh/complete/_git-ps Normal file
View File

@ -0,0 +1,14 @@
#compdef git-ps
#description switches to specified branch and updates from remote
_git-ps() {
local options=(
'-d:detect base branch'
)
for branch in $(git branch 2>/dev/null | sed 's/^..//'); do
options+=("${branch}:$(git log -n1 --format='[%G?] %(describe:tags) - %ar - %s - %an' ${branch})")
done
_describe 'branches' options
}