Skip to content

Commit

Permalink
49664: Use associative array for third-party completion
Browse files Browse the repository at this point in the history
  • Loading branch information
aschrab authored and Oliver Kiddle committed Dec 28, 2021
1 parent 85bf974 commit 92c80e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2021-12-29 Oliver Kiddle <opk@zsh.org>

* Aaron Schrab: 49664: Completion/Unix/Command/_git:
Use associative array for third-party completion

* 49668: Completion/Unix/Command/_zfs,
Completion/Unix/Type/_zfs_dataset: update zfs completion

Expand Down
8 changes: 4 additions & 4 deletions Completion/Unix/Command/_git
Original file line number Diff line number Diff line change
Expand Up @@ -6267,8 +6267,8 @@ _git_commands () {
zstyle -a :completion:$curcontext: user-commands user_commands

local command
for command in $_git_third_party_commands; do
(( $+commands[git-${command%%:*}] )) && third_party_commands+=$command
for command in ${(k)_git_third_party_commands}; do
(( $+commands[git-${command}] )) && third_party_commands+=$command$_git_third_party_commands[$command]
done

local -a aliases
Expand Down Expand Up @@ -8475,7 +8475,7 @@ _git() {
}

# Load any _git-* definitions so that they may be completed as commands.
declare -gUa _git_third_party_commands
declare -gA _git_third_party_commands
_git_third_party_commands=()

local file input
Expand All @@ -8497,7 +8497,7 @@ for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do
(( i++ ))
done < $file

_git_third_party_commands+=$name$desc
_git_third_party_commands+=([$name]=$desc)
done

_git

0 comments on commit 92c80e7

Please sign in to comment.