Merge pull request #97 from luolimao/master

AUR/Pactree package completion
This commit is contained in:
Julien Nicoulaud 2012-09-09 08:15:19 -07:00
commit 9966dd96a0
2 changed files with 49 additions and 17 deletions

26
src/_pactree Normal file
View File

@ -0,0 +1,26 @@
#compdef pactree
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for pactree 4.0
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Limao Luo <luolimao@gmail.com>
#
# ------------------------------------------------------------------------------
typeset -A opt_args
_pactree() {
local -a cmd packages packages_long
packages_long=(/var/lib/pacman/local/*(/))
packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} )
compadd "$@" -a packages
}
# run the main dispatcher
_pactree "$@"

View File

@ -137,10 +137,16 @@ _yaourt_completions_all_packages() {
if compset -P1 '*/*'; then
packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) )
typeset -U packages
if [[ -d /var/aur ]]; then
packages=( $packages $(ls /var/aur) )
fi
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
else
packages=( $(_call_program packages $cmd[@] -Sql) )
typeset -U packages
if [[ -d /var/aur ]]; then
packages=( $packages $(ls /var/aur) )
fi
_wanted packages expl "packages" compadd - "${(@)packages}"
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})