[Pkg-zsh-devel] Bug#632140: zsh: Completion for aptitude format strings

Daniel Bolton dan at dbbo.us
Wed Jun 29 20:06:01 UTC 2011


Package: zsh
Version: 4.3.12-1
Severity: wishlist
Tags: patch


I've modified the _aptitude compdef file to provide a useful completion list
for the various %-escaped strings that are passable to the -F or
--display-format option. The patch is included; it is also available on my
GitHub:


https://github.com/dbbolton/zsh-stuff/blob/master/_aptitude.patch



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.37-dbb-deb (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages zsh depends on:
ii  libc6                         2.13-7     Embedded GNU C Library: Shared lib
ii  libcap2                       1:2.21-1   support for getting/setting POSIX.
ii  libncursesw5                  5.9-1      shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libc6                         2.13-7     Embedded GNU C Library: Shared lib
ii  libpcre3                      8.12-3     Perl 5 Compatible Regular Expressi

Versions of packages zsh suggests:
ii  zsh-doc                       4.3.12-1   zsh documentation - info/HTML form

-- no debconf information
-------------- next part --------------
--- /usr/share/zsh/functions/Completion/Debian/_aptitude.orig	2011-06-29 15:50:06.000000000 -0400
+++ /usr/share/zsh/functions/Completion/Debian/_aptitude	2011-06-29 15:53:35.000000000 -0400
@@ -13,6 +13,39 @@
   #}}}
 }
 
+# Helper function for -F / --display-format
+function _aptitude_format_strings() {
+	_values -s , 'format string' \
+		'%%[Literal %]' \
+		'%#number[Parameter replacement]' \
+		'%a[Action flag]' \
+		'%A[Action]' \
+		'%B[Broken count]' \
+		'%c[Current state flag]' \
+		'%C[Current state]' \
+		'%d[Description]' \
+		'%H[Hostname]' \
+		'%i[Pin priority]' \
+		'%I[Installed size]' \
+		'%m[Maintainer]' \
+		'%M[Automatic flag]' \
+		'%n[Program version]' \
+		'%N[Program name]' \
+		'%o[Download size]' \
+		'%p[Package name]' \
+		'%P[Priority]' \
+		'%r[Reverse depends count]' \
+		'%R[Abbreviated priority]' \
+		'%s[Section]' \
+		'%S[Trust status]' \
+		'%t[Archive]' \
+		'%T[Tagged]' \
+		'%u[Disk usage change]' \
+		'%v[Current version]' \
+		'%V[Candidate version]' \
+		'%Z[Size change]'
+}
+
 _arguments -C \
   '(- 1 *)'{-h,--help}'[display help information]' \
   '(- 1 *)--version[display version information]' \
@@ -20,7 +53,7 @@
   '(-d --download-only)'{-d,--download-only}"[just download packages - don\'t install]" \
   '(-P --prompt)'{-P,--prompt}'[always display a prompt]' \
   '(-y --assume-yes)'{-y,--assume-yes}'[assume yes answer to questions]' \
-  '(-F --display-format)'{-F,--display-format}'[specify output format for search command]:format' \
+  '(-F --display-format)'{-F,--display-format}'[specify output format for search command]:format:_aptitude_format_strings' \
   '(-O --sort)'{-O,--sort}'[specify sort order]:sort order:()' \
   '(-w --width)'{-w,--width}'[specify output width]:width' \
   '-f[aggressivley try to fix dependencies of broken packages]' \


More information about the Pkg-zsh-devel mailing list