Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: update aptitude completion
- X-seq: zsh-workers 47294
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: update aptitude completion
- Date: Tue, 04 Aug 2020 20:05:02 +0200
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-08/96477-1596564302.073604%40NNRg.L5L8.bSpz>
- Authentication-results: zsh.org; iprev=pass (sonic306-20.consmr.mail.ir2.yahoo.com) smtp.remote-ip=77.238.176.206; dkim=pass header.d=yahoo.co.uk header.s=s2048 header.a=rsa-sha256
- Delivery-date: Tue, 04 Aug 2020 18:05:30 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1596564305; bh=G34GsIzJktdi0KkHNs3XBn6aZ9LBtC6kOA2K2kphLzo=; h=From:To:Subject:Date:References:From:Subject; b=WQ50PMm1B9gbladm89qc83rqUZwAyClciGIQ1LBT9MTzaX7ZHWvpmZi7OmoPZu/DPe1Uks+osvP1B6934Aelp19AgEq5+KHYweLBNbFRMmEPi0fpDr9tXLa6X8WjobCUymxSfO6d25sk/Ew0ZDa/DeHx3Yf0l3n4l8XC+seVo81kQoxyvVJ3xXEgofyIAe+rtIJveuKW1aaBmgYRClnn+237zv89sQtuDVcoQnM/DMXk2xsYb0WaURWT+aLQ00bD5YCelj4bz2TB5edT3ur2ja3ooM8wR/hAicjHpfoFOywMwezPRPg4MDGC9FSR8tGRXMAoJhUSQqS/dSjiZcv81g==
- Envelope-to: archives@xxxxxxxxxxxx
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <96477-1596564302.073604.ref@NNRg.L5L8.bSpz>
- Sender: Sympa Owner <sympa@xxxxxxx>
This brings completion for aptitude somewhat more up-to-date.
Oliver
diff --git a/Completion/Debian/Command/_aptitude b/Completion/Debian/Command/_aptitude
index bbaa8ebbd..91d233f11 100644
--- a/Completion/Debian/Command/_aptitude
+++ b/Completion/Debian/Command/_aptitude
@@ -1,60 +1,32 @@
#compdef aptitude
-local curcontext="$curcontext" state line cmds ret=1
-
-function _aptitude_release() {
- #{{{
- local expl releases
- releases=(
-${${(M)${(f)"$(</etc/apt/sources.list)"}\
-:#[ $'\t']#deb(|-src)*}/(#b)[ $'\t']#[^ $'\t']##[ $'\t']##[^ $'\t']##[ $'\t']##([^ $'\t']##)*/$match[1]}
- )
- _wanted list expl release compadd ${expl} - ${(u)releases}
- #}}}
-}
-
-# 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]'
-}
+local curcontext="$curcontext" sep ret=1
+local state line expl specs disp cmds suf
_arguments -C \
'(- 1 *)'{-h,--help}'[display help information]' \
'(- 1 *)--version[display version information]' \
+ '--add-user-tag=[add user tag to affected packages]:tag' \
+ '--add-user-tag-to=[add user tag to matching packages]:tag,pattern' \
+ '--allow-new-upgrades[install upgrades for packages regardless]' \
+ '(--no-new-installs)--allow-new-installs[allow the safe-upgrade command to install new packages]' \
+ '--allow-untrusted[install packages from untrusted sources without prompting]' \
+ '--disable-columns[output results without any special formatting]' \
+ '(-F --display-format)'{-F,--display-format}'[specify output format for search command]:format:->format-strings' \
+ '--group-by=[control how the versions command groups its output]:grouping:(archive auto none package source-package source-version)' \
+ '--log-file=[specify output log file]:file:_files' \
+ '*--log-level=[specify mimimum message level to log]:level:compadd -o nosort off fatal error warn info debug trace' \
+ '--log-resolver[set some standard log levels related to the resolver]' \
+ '(--allow-new-installs)--no-new-installs[prevent safe-upgrade from installing any new packages]' \
+ '(--allow-new-upgrades)--no-new-upgrades[prevent safe-upgrade from upgrading packages regardless]' \
+ "--no-show-resolver-actions[don't display the actions performed by the “safe” resolver]" \
+ '(-O --sort)'{-O,--sort}'[specify sort order]:sort order:->orderings' \
+ '-o[set a configuration file option]:key=value' \
'(-s --simulate)'{-s,--simulate}'[print actions without performing them]' \
'(-d --download-only)'{-d,--download-only}"[just download packages - don\'t install]" \
'(-P --prompt)'{-P,--prompt}'[always display a prompt]' \
+ '--purge-unused[purge in addition to removing each package that is no longer required]' \
'(-y --assume-yes)'{-y,--assume-yes}'[assume yes answer to questions]' \
- '(-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[aggressively try to fix dependencies of broken packages]' \
'(-V --show-versions)'{-V,--show-versions}'[show which versions of packages will be installed]' \
@@ -65,25 +37,72 @@ _arguments -C \
'(--without-suggests)--with-suggests[install suggested packages when installing new packages]' \
'(-r --with-recommends)'{-r,--without-recommends}'[ignore recommended packages when installing new packages]' \
'(--with-suggests)--without-suggests[ignore suggested packages when installing new packages]' \
- '(-t --target-release)'{-t,--target-release}'[set the release from which packages should be installed]:release:_aptitude_release' \
+ '--remove-user-tag=[remove user tag from affected packages]:tag' \
+ '--remove-user-tag-from=[remove user tag from matching packages]:tag,pattern' \
+ '(-t --target-release)'{-t,--target-release}'[set the release from which packages should be installed]:release:->aptitude-releases' \
'(-q --quiet)'{-q=,--quiet=}'[less Output]:level' \
'--schedule-only[schedule operations to be performed in the future]' \
'--purge-unused[purge unused packages instead of removing]' \
'--visual-preview[start up the visual interface and display its preview screen]' \
'--full-resolver[attempts to resolve conflicts with a higher risk of breakage]' \
'--safe-resolver[attempts to resolve conflicts with a lower risk of breakage]' \
+ '--show-package-names[control when the versions command shows package names]:when:(always auto never)' \
+ '--show-summary=[summarize each dependency chain that the why command outputs]::mode:(no-summary first-package first-package-and-type all-packages all-packages-with-dep-versions)' \
+ '(-W --show-why)'{-W,--show-why}'[show which manually installed package requires each automatically installed package]' \
'-S[load the extended state information from non-standard state file]:state file:_files' \
'-u[begin updating the package lists as soon as the program starts]' \
'-i[displays a download preview when the program starts]' \
+ '-Z[show how much disk space will be used or freed by the individual packages]' \
'1: :->cmds' \
'*: :->args' && ret=0
case $state in
+ aptitude-releases)
+ releases=(
+ ${${(M)${(f)"$(</etc/apt/sources.list)"}\
+:#[ $'\t']#deb(|-src)*}/(#b)[ $'\t']#[^ $'\t']##[ $'\t']##[^ $'\t']##[ $'\t']##([^ $'\t']##)*/$match[1]}
+ )
+ _description releases expl release
+ compadd "$expl[@]" -a releases && ret=0
+ ;;
cmds)
cmds=( ${${(M)${(f)"$(_call_program commands aptitude -h 2>/dev/null)"}:# [^- ][^ ]## *}/(#b) ([^ ]##) ##(- )#([^- ]*)/$match[1]:$match[3]:l})
_describe -t commands 'aptitude command' cmds && ret=0
;;
+ format-strings)
+ compset -P '(%\#[0-9]|%[A-Za-z%]|[^%])#'
+ compset -S '*'
+ zstyle -s ":completion:${curcontext}:format-specifiers" list-separator sep || sep=--
+ specs=(
+ '%%:literal %' '%#:parameter replacement' '%a:action flag'
+ '%A:action' '%B:broken count' '%c:current state flag'
+ '%C:current state' '%d:description' '%D:package size'
+ '%E:architecture' '%H:hostname' '%i:pin priority'
+ '%I:installed size' '%m:maintainer' '%M:automatic flag'
+ '%n:program version' '%N:program name' '%o:download size'
+ '%O:origin' '%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'
+ )
+ zformat -a disp " $sep " $specs
+ _description format-specifiers expl 'format specifier'
+ compadd "$expl[@]" -S '' -d disp - ${specs%:*}
+ ;;
+ orderings)
+ line=( "${(@)${(@)${(@s.,.)PREFIX}#(\\|)\~}[1,-2]}" )
+ compset -P '*,'
+ compset -S ',*' || suf=( -qS , )
+ if ! compset -P '(\\|)~'; then
+ _description prefixes expl 'reverse order'
+ compadd "$expl[@]" -S '' \~ && ret=0
+ fi
+ _description sort-key expl 'order [name,version]'
+ compadd -F line "$expl[@]" $suf - installsize installsizechange debsize \
+ name priority version && ret=0
+ ;;
args)
case $line[1] in
search)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author