zsh-workers
 help / color / mirror / code / Atom feed
From: "Hauser, Felix (MRT)" <felix.hauser@kit.edu>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: <zsh-workers@zsh.org>
Subject: Re: apt autocompletion issue
Date: Tue, 30 Jul 2019 13:49:03 +0200	[thread overview]
Message-ID: <5fb63e1b-7dc1-63cf-9a55-31fa5b4b423a@kit.edu> (raw)
In-Reply-To: <79188-1564444425.709181@h-V7.a7lO.lIR7>


On 30.07.19 01:53, Oliver Kiddle wrote:
> 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' \# \| \
> 


Well, I guess the Debian package sets should be:
--installed "installed"
--all-versions "avail"
--upgradeable Do not know the option for this one. Result should be a 
list of all packages that can be updated by "apt upgrade".

But the problem is not only with "apt list" but with all apt commands.
The apt package brings its own detailed completion file (not via the 
bash-completions package):
https://salsa.debian.org/apt-team/apt/blob/master/completions/bash/apt
This is the one used by bash and is located at 
"/usr/share/bash-completion/completions/apt" on my system.
Maybe zsh can simply access the bash completion file and ignore its 
own?? Not sure if this can be done ...

I hesitated replacing "/usr/share/zsh/functions/Completion/Debian/_apt" 
with the bash file, because in the zsh completion file there are also 
the instructions for apt-get etc.

Felix

  reply	other threads:[~2019-07-30 11:49 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
2019-07-30 11:49   ` Hauser, Felix (MRT) [this message]
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=5fb63e1b-7dc1-63cf-9a55-31fa5b4b423a@kit.edu \
    --to=felix.hauser@kit.edu \
    --cc=okiddle@yahoo.co.uk \
    --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).