Complete the pacapt completion
* the completion function was not formulated properly
This commit is contained in:
parent
7e33cb16f3
commit
f8cda1867b
39
src/_pacapt
39
src/_pacapt
|
@ -1,14 +1,8 @@
|
|||
#compdef pacapt
|
||||
|
||||
local zsh_pacapt_path="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
_pacapt_action() {
|
||||
_arguments -s : \
|
||||
"$_pacapt_opts_commands[@]"
|
||||
}
|
||||
|
||||
# ----- APT
|
||||
if which apt > /dev/null; then
|
||||
_pacapt(){
|
||||
# ----- APT
|
||||
if which apt > /dev/null; then
|
||||
zsh_pacapt_init=true
|
||||
|
||||
_pacapt_available_packages() {
|
||||
|
@ -19,8 +13,8 @@ if which apt > /dev/null; then
|
|||
_values 'Installed packages' $(pacapt -Q | awk '{print $2}')
|
||||
}
|
||||
|
||||
# ----- YUM
|
||||
elif which yum > /dev/null; then
|
||||
# ----- YUM
|
||||
elif which yum > /dev/null; then
|
||||
zsh_pacapt_init=true
|
||||
|
||||
_pacapt_yum_list() {
|
||||
|
@ -34,8 +28,8 @@ elif which yum > /dev/null; then
|
|||
_pacapt_installed_packages() {
|
||||
_pacapt_yum_list installed
|
||||
}
|
||||
# ----- BREW
|
||||
elif which brew > /dev/null; then
|
||||
# ----- BREW
|
||||
elif which brew > /dev/null; then
|
||||
zsh_pacapt_init=true
|
||||
|
||||
_pacapt_available_packages() {
|
||||
|
@ -45,9 +39,9 @@ elif which brew > /dev/null; then
|
|||
_pacapt_installed_packages() {
|
||||
_values 'Installed packages' $(brew list)
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
_pacapt_zsh_comp() {
|
||||
_pacapt_zsh_comp() {
|
||||
case $words[2] in
|
||||
-Qi) _pacapt_available_packages ;;
|
||||
-Qo) _files ;;
|
||||
|
@ -58,11 +52,12 @@ _pacapt_zsh_comp() {
|
|||
- ) _gnu_generic ;;
|
||||
* ) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
if "$zsh_pacapt_init" = true; then
|
||||
_pacapt_zsh_comp $@
|
||||
else
|
||||
_gnu_generic $@
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
if "$zsh_pacapt_init" = true; then
|
||||
compdef _pacapt_zsh_comp pacapt
|
||||
else
|
||||
compdef _gnu_generic pacapt
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue