fix: Restore zsh completions to working completion (#1079)

This commit is contained in:
Edwin Kofler 2023-09-22 22:38:15 -07:00 committed by GitHub
parent e4152db482
commit 954ba1fb7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,31 +101,12 @@ __gitex_author_names() {
_wanted author-names expl author-name compadd $* - $author_names
}
__gitex_author_emails2() {
echo "$g s"
# read -Ac words
# read -cn cword
local expl
declare -a author_names=($state)
local name="${words[2]}" # name of the author supplied on the command line
local -a authors=("${(f)$(git authors --list)}")
for line in "${authors[@]}"; do
if [ "${line% *}" = "$name" ]; then
local email=${line#*<}
email=${email%>*}
author_names+=("${email#* }")
fi
done
# _wanted author-names expl author-name compadd $* - $author_names
reply=(a b c)
}
__gitex_author_emails() {
compctl -K __gitex_author_emails2
local expl
declare -a author_names
author_names=(${(f)"$(_call_program branchrefs git log --format='%aE' | sort -u)"})
__gitex_command_successful || return
_wanted author-names expl author-name compadd $* - $author_names
}
# subcommands
@ -148,10 +129,9 @@ _git-clear() {
}
_git-coauthor() {
compctl -K __gitex_author_emails2 a
# _arguments \
# ':co-author[co-author to add]:__gitex_author_names' \
# ':co-author-email[email address of co-author to add]:__gitex_author_emails'
_arguments \
':co-author[co-author to add]:__gitex_author_names' \
':co-author-email[email address of co-author to add]:__gitex_author_emails'
}
_git-contrib() {