zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: "Hauser, Felix (MRT)" <felix.hauser@kit.edu>
Cc: zsh-workers@zsh.org
Subject: Re: apt autocompletion issue
Date: Tue, 30 Jul 2019 01:53:45 +0200	[thread overview]
Message-ID: <79188-1564444425.709181@h-V7.a7lO.lIR7> (raw)
In-Reply-To: <71694f56-b34d-d1d7-51a4-16aa937a26cc@kit.edu>

On 26 Jul, "Hauser, Felix (MRT)" wrote:
> just discovered the Z-shell and so far it really makes my life a little 
> bit easier! The only issue I have with it is the completion of options 
> for the apt command. So e.g.:
>
> apt list --u<tab>
>
> won't autocomplete to
>
> apt list --upgradeable
>
> which is easily done in the normal bash file.
> Since in my workflow I often have to use apt, this feature is kinda 
> important to me.

Thanks for the report. I'm afraid the Debian specific completions aren't
as well maintained as they once were.

It's not clear from the man page whether the three options can be
combined with the glob(7) patterns for matching packages (as per the
patch below) or whether they need to be standalone.

The option should probably modify whether it is calling _deb_packages
with "avail", "installed", "uninstalled" or some other package set. If
you let me know what the relevant package set argument should be for
each option, then it is easy to do that.

Oliver

diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index 4486aa26d..d36d5240a 100644
--- a/Completion/Debian/Command/_apt
+++ b/Completion/Debian/Command/_apt
@@ -399,7 +399,10 @@ _apt-cmd () {
     -o,--option:arbitem \
     -t,--target-release:release \
     -- \
-    /$'list\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'list\0'/ \( \
+      \( // %-% /$'--[^\0]#\0'/ ':options:option:(--installed --upgradable --all-versions)' \| \) \
+      /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \
+    \) \| \
     /$'search\0'/ /$'[^\0]#\0'/ ':strings:pattern:' \| \
     /$'showsrc\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
     /$'show\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \

  reply	other threads:[~2019-07-29 23:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26 16:20 Hauser, Felix (MRT)
2019-07-29 23:53 ` Oliver Kiddle [this message]
2019-07-30 11:49   ` Hauser, Felix (MRT)
2019-07-30 13:02     ` Daniel Shahaf
2019-07-30 14:53   ` Axel Beckert
2019-07-30 22:13     ` Oliver Kiddle
2019-07-30 23:21       ` aptitude vs apt vs apt-get (was: Re: [Pkg-zsh-devel] apt autocompletion issue) Axel Beckert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79188-1564444425.709181@h-V7.a7lO.lIR7 \
    --to=okiddle@yahoo.co.uk \
    --cc=felix.hauser@kit.edu \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).