From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 09a21d71 for ; Tue, 30 Jul 2019 11:49:53 +0000 (UTC) Received: (qmail 22366 invoked by alias); 30 Jul 2019 11:49:47 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44588 Received: (qmail 5567 invoked by uid 1010); 30 Jul 2019 11:49:47 -0000 X-Qmail-Scanner-Diagnostics: from scc-mailout-kit-01.scc.kit.edu by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25524. spamassassin: 3.4.2. Clear:RC:0(129.13.231.81):SA:0(-4.3/5.0):. Processed in 3.545438 secs); 30 Jul 2019 11:49:47 -0000 X-Envelope-From: felix.hauser@kit.edu X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at kit.edu designates 129.13.231.81 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kit.edu; s=20190212; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:CC:To:Subject; bh=C9CoailtRC0A/j7PuaCPrSZ1/nGX9q4jGTRCmBYfRds=; b=jGPl5Zpc1Trxonmb+k4nTErfyRytxwjy8H1m461bjF/nvAdH8RoIg0LsKen2KN38nOoJzv6TLfD3jaXs8FTVrk7vTVndglFTpV6TfpAFhBHY1ZfMBvHt5K3TmLzJxkm8M7O5goWRsWOUbpLA7wZ7Q3Y7Y1p6h6DRv1QRdnQWAPc=; Subject: Re: apt autocompletion issue To: Oliver Kiddle CC: References: <71694f56-b34d-d1d7-51a4-16aa937a26cc@kit.edu> <79188-1564444425.709181@h-V7.a7lO.lIR7> From: "Hauser, Felix (MRT)" Message-ID: <5fb63e1b-7dc1-63cf-9a55-31fa5b4b423a@kit.edu> Date: Tue, 30 Jul 2019 13:49:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <79188-1564444425.709181@h-V7.a7lO.lIR7> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 >> >> 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