[pacman-dev] [PATCH 2/2] add zsh completion for makepkg

Daniel Wallace daniel.wallace at gatech.edu
Sun Apr 15 20:28:03 EDT 2012


Right now the only completion for zsh for makepkg comes from pkgtool,
and the 2 options that come from that are --chown and --linkadd which
aren't options for makepkg anyway.  This should add completion for all
the flags for makepkg

sorry about the last email, apparently I had messed with something and 
forgotten about it, and it had changed in the new zsh_completion.in

this should be the correct one and not change stuff in _pacman_comp or
in the _pacman_key in [patch 1/2]

Signed-off-by: Daniel Wallace <daniel.wallace at gatech.edu>
---
 contrib/zsh_completion.in |  154 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 150 insertions(+), 4 deletions(-)

diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in
index 73ce42f..19082f2 100644
--- a/contrib/zsh_completion.in
+++ b/contrib/zsh_completion.in
@@ -1,4 +1,4 @@
-#compdef pacman pacman.static=pacman pacman-key
+#compdef pacman pacman.static=pacman pacman-key makepkg
 
 # copy this file to /usr/share/zsh/site-functions/_pacman
 
@@ -368,8 +368,156 @@ _keys() {
   _describe -t modules 'keys in keyring' keys && return 0
 }
 
+_makepkg_opts_common=(
+    '-s[Install missing dependencies with pacman]'
+    '-i[Install package after successful build]'
+    '-A[Ignore incomplete arch field in PKGBUILD]'
+    '-c[Clean up work files after build]'
+    '-d[Skip all dependency checks]'
+    '-e[Do not extract source files (use existing src/ dir)]'
+    '-f[Overwrite existing package]'
+    '-g[Generate integrity checks for source files]'
+    '-h[Show help message and exit]'
+    '-L[Log package build process]'
+    '-m[Disable colorized output messages]'
+    '-o[Download and extract files only]'
+    '-p[Use an alternate build script (instead of 'PKGBUILD')]: :_files'
+    '-r[Remove installed dependencies after a successful build]'
+    '-R[Repackage contents of the package without rebuilding]'
+    '-S[Generate a source-only tarball without downloading sources]'
+    )
+
+_makepkg_action_none(){
+  _arguments \
+		"$_makepkg_opts_common[@]"\
+    "$_double_makepkg[@]"
+}
+_double_makepkg=(
+  '--ignorearch[Ignore incomplete arch field in PKGBUILD]'
+  '--clean[Clean up work files after build]'
+  '--nodeps[Skip all dependency checks]'
+  '--noextract[Do not extract source files (use existing src/ dir)]'
+  '--force[Overwrite existing package]'
+  '--geninteg[Generate integrity checks for source files]'
+  '--help[Show help message and exit]'
+  '--install[Install package after successful build]'
+  '--log[Log package build process]'
+  '--nocolor[Disable colorized output messages]'
+  '--nobuild[Download and extract files only]'
+  '--rmdeps[Remove installed dependencies after a successful build]'
+  '--repackage[Repackage contents of the package without rebuilding]'
+  '--syncdeps[Install missing dependencies with pacman]'
+  '--source[Generate a source-only tarball without downloading sources]'
+  '--allsource[Generate a source-only tarball including downloaded source]'
+  '--asroot[Allow makepkg to run as root user]'
+  '--check[Run check() function in the PKGBUILD]'
+  '--config[Use an alternate config file instead of '/etc/makepkg.conf']: :_files'
+  '--holdver[Prevent automatic version bumping for development PKGBUILDs]'
+  '--key[Specify key to use for gpg signing instead of the default]: :_keys'
+  '--nocheck[Do not run the check() function in the PKGBUILD]'
+  '--nosign[Do not create a signature for the package]'
+  '--pkg[Only build listed packages from a split package]'
+  '--sign[Sign the resulting package with gpg]'
+  '--skipchecksums[Do not verify checksums of the source files]'
+  '--skipinteg[do not perform any verification checks on source files]'
+  '--skippgpcheck[Do not verify source files with PGP signatures]'
+  '--noconfirm[do not ask for confirmation when resolving dependencies]'
+  '--noprogressbar[Do not show a progress bar when downloading files]'
+  )
+_makepkg(){
+    case $words[2] in
+      -A*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -c*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -d*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -e*)
+        _arguments \
+          "$_makepkg_opts_common[@]"
+          "$_double_makepkg[@]"
+          ;;
+      -f*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -g*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -h*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -i*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -L*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -m*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -o*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -p*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -r*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -R*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -S*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+          ;;
+      -s*)
+        _arguments \
+          "$_makepkg_opts_common[@]" \
+          "$_double_makepkg[@]"
+        ;;
+      --* )
+        _arguments -s \
+          "$_double_makepkg[@]" 
+        ;;
+      - )_makepkg_action_none ;;
+      * ) return 1;;
+    esac
+}
 _pacman_comp() {
   case "$service" in
+    makepkg)
+      _makepkg "$@";;
     pacman-key) 
       _pacman_key "$@";;
     pacman) 
@@ -379,8 +527,6 @@ _pacman_comp() {
   esac
 }
 
-_pacman_comp "$@"
-
+_pacman_comp
 
 
-# vim: ft=zsh sw=2 ts=2 et
-- 
1.7.10



More information about the pacman-dev mailing list