[pacman-dev] [PATCH] zsh_completion: Add proper completion for --ignore and --ignoregroup
Nezmer
git at nezmer.info
Wed Jan 20 09:23:58 EST 2010
The patch provides proper comma-separated completion for --ignore
and --ignoregroup
Signed-off-by: Nezmer <git at nezmer.info>
---
This version of the patch is simpler.
contrib/zsh_completion | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/contrib/zsh_completion b/contrib/zsh_completion
index 2f43d9b..b751c82 100644
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion
@@ -86,9 +86,9 @@ _pacman_opts_sync_modifiers=(
'-w[Download packages only]'
'-y[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package:
- _pacman_completions_all_packages'
- '*--ignoregroup[Ignore a group upgrade]:package group:
- _pacman_completions_all_groups'
+ _pacman_completions_ignore_packages'
+ '*--ignoregroup[Ignore a group upgrade]:group:
+ _pacman_completions_ignore_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
)
@@ -240,6 +240,26 @@ _pacman_completions_all_packages() {
fi
}
+# provides comma-separated completions for packages available from repositories
+# to be used with --ignore
+_pacman_completions_ignore_packages() {
+ local -a cmd packages
+ _pacman_get_command
+ packages=($(pacman -Slq))
+ typeset -U packages
+ _wanted packages expl "packages" _values -s "," compadd - "${(@)packages}"
+}
+
+# provides comma-separated completions for package groups to be used
+# with --ignoregroup
+_pacman_completions_ignore_groups() {
+ local -a cmd groups
+ _pacman_get_command
+ groups=($(pacman -Sg))
+ typeset -U groups
+ _wanted groups expl "groups" _values -s "," compadd - "${(@)groups}"
+}
+
# provides completions for package groups
_pacman_completions_installed_groups() {
local -a cmd groups
--
1.6.6
More information about the pacman-dev
mailing list