diff --git a/src/_pactree b/src/_pactree new file mode 100644 index 0000000..06bd404 --- /dev/null +++ b/src/_pactree @@ -0,0 +1,26 @@ +#compdef pactree +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for pactree 4.0 +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Limao Luo +# +# ------------------------------------------------------------------------------ + +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 "$@" diff --git a/src/_yaourt b/src/_yaourt index ae5fcbf..ef2b027 100644 --- a/src/_yaourt +++ b/src/_yaourt @@ -25,39 +25,39 @@ _yaourt_action_query() { # "$_yaourt_opts_common[@]" \ # "$_yaourt_opts_query_actions[@]" \ # "$_yaourt_opts_query_modifiers[@]" - + case $state in query_file) _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:package file:_files -g "*.pkg.tar.*"' - ;; + ;; query_group) _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:groups:_yaourt_completions_installed_groups' - ;; + ;; query_owner) _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:file:_files' - ;; + ;; query_search) _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:search text: ' - ;; + ;; *) _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_actions[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:package:_yaourt_completions_installed_packages' - ;; + ;; esac } @@ -77,7 +77,7 @@ _yaourt_action_sync() { # "$_yaourt_opts_common[@]" \ # "$_yaourt_opts_sync_actions[@]" #\ # #"$_yaourt_opts_sync_modifiers[@]" - + case $state in sync_clean) _arguments -s : \ @@ -90,20 +90,20 @@ _yaourt_action_sync() { "$_yaourt_opts_common[@]" \ "$_yaourt_opts_sync_modifiers[@]" \ '*:package group:_yaourt_completions_all_groups' - ;; + ;; sync_search) _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_sync_modifiers[@]" \ '*:search text: ' - ;; + ;; *) _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_sync_modifiers[@]" \ '*:package:_yaourt_completions_all_packages' - ;; - esac + ;; + esac } # handles --upgrade subcommand @@ -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)"$(