From 2cea257954b783b3d667765a3c705d12521c0321 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 28 Sep 2022 15:49:44 +0200 Subject: [PATCH] Add auto-completion for `git-ps` command Signed-off-by: Knut Ahlers --- .zsh/complete/_git-ps | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .zsh/complete/_git-ps diff --git a/.zsh/complete/_git-ps b/.zsh/complete/_git-ps new file mode 100644 index 0000000..bc59731 --- /dev/null +++ b/.zsh/complete/_git-ps @@ -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 +}