Skip to content

Commit

Permalink
completion: zsh: improve main function selection
Browse files Browse the repository at this point in the history
Sometimes we want to use the function directly (e.g. _git_checkout), for
example when zsh has the option 'complete_aliases', this way, we can do
something like:

  compdef _git gco=git_checkout

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information
felipec committed Jun 21, 2019
1 parent 7051469 commit 453c793
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion git-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ _git ()

if (( $+functions[__${service}_zsh_main] )); then
__${service}_zsh_main
else
elif (( $+functions[__${service}_main] )); then
emulate ksh -c __${service}_main
elif (( $+functions[_${service}] )); then
emulate ksh -c _${service}
fi

let _ret && _default && _ret=0
Expand Down

0 comments on commit 453c793

Please sign in to comment.