From 0f7eebbfac6698b6b9a3183ef13375a32174f089 Mon Sep 17 00:00:00 2001 From: luolimao Date: Fri, 31 Aug 2012 04:45:03 -0400 Subject: [PATCH 1/5] added completions for AUR packages --- src/_yaourt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/_yaourt b/src/_yaourt index ae5fcbf..30079e0 100644 --- a/src/_yaourt +++ b/src/_yaourt @@ -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)"$( Date: Sat, 1 Sep 2012 10:22:55 -0400 Subject: [PATCH 2/5] added pactree completion --- src/_pactree | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/_pactree diff --git a/src/_pactree b/src/_pactree new file mode 100644 index 0000000..3a5cc36 --- /dev/null +++ b/src/_pactree @@ -0,0 +1,14 @@ +#compdef pactree pactree.static=pactree + +# copy this file to /usr/share/zsh/site-functions/_pactree +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 "$@" From a89cb91318c4c3ecad516f1b6d51799305c1451b Mon Sep 17 00:00:00 2001 From: luolimao Date: Sun, 2 Sep 2012 02:23:03 -0400 Subject: [PATCH 3/5] turned tabs into spaces --- src/_yaourt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/_yaourt b/src/_yaourt index 30079e0..5d78947 100644 --- a/src/_yaourt +++ b/src/_yaourt @@ -137,16 +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 + 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 + if [[ -d /var/aur ]]; then + packages=( $packages $(ls /var/aur) ) + fi _wanted packages expl "packages" compadd - "${(@)packages}" repositories=(${(o)${${${(M)${(f)"$( Date: Sun, 2 Sep 2012 02:26:59 -0400 Subject: [PATCH 4/5] fixed indentation in general --- src/_yaourt | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/_yaourt b/src/_yaourt index 5d78947..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 @@ -260,8 +260,8 @@ _yaourt() { '-m[List installed packages not found in sync db(s)]' '-t[List packages not required by any package]' '-u[List packages that can be upgraded]' - '--aur[Install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]' - '--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]' + '--aur[Install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]' + '--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]' ) # options for passing to _arguments: options for --remove command @@ -309,19 +309,19 @@ _yaourt() { "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:groups:_yaourt_completions_installed_groups' - ;; + ;; -Q*o*) # file _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:package file:_files' - ;; + ;; -Q*p*) # file *.pkg.tar.* _arguments -s : \ "$_yaourt_opts_common[@]" \ "$_yaourt_opts_query_modifiers[@]" \ '*:package file:_files -g "*.pkg.tar.*"' - ;; + ;; -Q*) _yaourt_action_query ;; -R*) _yaourt_action_remove ;; -S*c*) # no completion @@ -338,7 +338,7 @@ _yaourt() { "$_yaourt_opts_common[@]" \ "$_yaourt_opts_sync_modifiers[@]" \ '*:package group:_yaourt_completions_all_groups' - ;; + ;; -S*) _yaourt_action_sync ;; -U*) _yaourt_action_upgrade ;; -V*) _yaourt_action_version ;; From 47a175cbcfb7a14856eaf7e67ebb97c51afd34c5 Mon Sep 17 00:00:00 2001 From: luolimao Date: Sun, 9 Sep 2012 08:58:09 -0400 Subject: [PATCH 5/5] added proper file header --- src/_pactree | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/_pactree b/src/_pactree index 3a5cc36..06bd404 100644 --- a/src/_pactree +++ b/src/_pactree @@ -1,6 +1,18 @@ -#compdef pactree pactree.static=pactree +#compdef pactree +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for pactree 4.0 +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Limao Luo +# +# ------------------------------------------------------------------------------ -# copy this file to /usr/share/zsh/site-functions/_pactree typeset -A opt_args _pactree() {