Skip to content

Commit 954ba1f

Browse files
authored
fix: Restore zsh completions to working completion (#1079)
1 parent e4152db commit 954ba1f

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

etc/git-extras-completion.zsh

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -101,31 +101,12 @@ __gitex_author_names() {
101101
_wanted author-names expl author-name compadd $* - $author_names
102102
}
103103

104-
__gitex_author_emails2() {
105-
echo "$g s"
106-
# read -Ac words
107-
# read -cn cword
108-
109-
local expl
110-
declare -a author_names=($state)
111-
112-
local name="${words[2]}" # name of the author supplied on the command line
113-
local -a authors=("${(f)$(git authors --list)}")
114-
for line in "${authors[@]}"; do
115-
if [ "${line% *}" = "$name" ]; then
116-
local email=${line#*<}
117-
email=${email%>*}
118-
119-
author_names+=("${email#* }")
120-
fi
121-
done
122-
123-
# _wanted author-names expl author-name compadd $* - $author_names
124-
reply=(a b c)
125-
}
126-
127104
__gitex_author_emails() {
128-
compctl -K __gitex_author_emails2
105+
local expl
106+
declare -a author_names
107+
author_names=(${(f)"$(_call_program branchrefs git log --format='%aE' | sort -u)"})
108+
__gitex_command_successful || return
109+
_wanted author-names expl author-name compadd $* - $author_names
129110
}
130111

131112
# subcommands
@@ -148,10 +129,9 @@ _git-clear() {
148129
}
149130

150131
_git-coauthor() {
151-
compctl -K __gitex_author_emails2 a
152-
# _arguments \
153-
# ':co-author[co-author to add]:__gitex_author_names' \
154-
# ':co-author-email[email address of co-author to add]:__gitex_author_emails'
132+
_arguments \
133+
':co-author[co-author to add]:__gitex_author_names' \
134+
':co-author-email[email address of co-author to add]:__gitex_author_emails'
155135
}
156136

157137
_git-contrib() {

0 commit comments

Comments
 (0)