[pacman] Remove dependency from completion module

The completion module has specific code for the pacman module, and we
want to make modules independent from each other.

Plus, as far as I checked, most of the pacman wrappers/frontends are
already packaged with zsh completion out of the box. I'm not an
archlinux user, but I checked the repos of the ones in
https://wiki.archlinux.org/index.php/AUR_helpers#Pacman_wrappers and
these contain zsh completion scripts:

* aura: https://github.com/aurapm/aura/blob/master/aura/doc/completions/_aura
* pacaur: https://github.com/rmarquis/pacaur/blob/master/zsh.completion
* pakku: https://github.com/kitsunyan/pakku/blob/master/completion/zsh.patch
* pikaur: https://github.com/actionless/pikaur/blob/master/packaging/usr/share/zsh/site-functions/_pikaur
* trizen: https://github.com/trizen/trizen/blob/master/zsh.completion
* yay: https://github.com/Jguer/yay/blob/master/completions/zsh

I didn't find zsh completions for the ones listed below, so I added a
compdef function for them inside the pacman module itself:

* aurman
* packer-aur
* wrapaur
* yaourt
This commit is contained in:
Eric Nielsen 2018-09-26 15:29:54 -05:00
parent df672688de
commit 61cc8182f9
3 changed files with 3 additions and 17 deletions

View File

@ -1,14 +0,0 @@
#
# Alias compdefs
#
# Any aliased commands will not function with completion without compdefs.
# Because completion is the LAST module to be loaded (so we make sure to catch all completions)
# we must assign the compdefs here, as opposed to within the modules themselves.
# Unfortunately, I'm not aware of a worthwhile way to ensure that these will be included in .zcompdump
# zpacman_frontend -> pacman
if (( ${+zpacman_frontend} )); then
compdef ${zpacman_frontend}='pacman'
fi

View File

@ -18,9 +18,6 @@ fpath=(${0:h}/external/src ${fpath})
# load and initialize the completion system
autoload -Uz compinit && compinit -C -d "${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump}"
# set any compdefs
source ${0:h}/compdefs.zsh
#
# zsh options

View File

@ -0,0 +1,3 @@
#compdef aurman packer wrapaur yaourt
service=pacman; _pacman