From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18696 invoked by alias); 22 Mar 2018 12:09:08 -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: 42497 Received: (qmail 15062 invoked by uid 1010); 22 Mar 2018 12:09:08 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.4/5.0):. Processed in 1.661201 secs); 22 Mar 2018 12:09:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=BFS/=GM=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1521720538; bh=JkSrBTGvxWU6Gh2sQJdgN14uyLBkBfm51xxEY9L0wA4=; h=From:References:To:Subject:Date:From:Subject; b=t35k5BDDC+uzI+Wg7KNRVG3fXUZ5sGxVJ10BpwP5Voss2R3aHAapgqSMFF0LzT+3BY/HHQPh0zp1md2j/048vOAaNA7Slu8tL1bbKiep6c+rxlDgiqFjEVruXtvjqIrDV+Gdbfw9p4VzhLhSS7U3OhaI+oNwTOmpuzoQb9v9R0EhMjYEksmspCz9Ix1ynobsJWPLQaKLY2MfXVfxNOU46dNTSPPaA2DgqiFoDTouaAGfF47FLelcDDZCblwEE3TOZUzxzuO5tu32BgcrCugau8qcYZ8DhuCRPgc7crd6YpQV6qJbqB+BkUMZY+ok/FazF9F8IPEqb9849/eTDgwCrg== X-YMail-OSG: x3Ahdt0VM1midQRk5sPgtpij1eCrjS8fOnvgSduvl2z.SAKVhzUO3ZTNdcRurQn oR_yZ1DHyH6vas9U4pA.hLEI4QvkyvF3bZH9ytdGASHVL38k2j1wAA0HFPHEdWM1AwKXJSoHJCm9 Xam211XaRNW68pQIH8kuETtYUHVKTr9b1Vnvn0YHpRel4Nh9O2vjPxnQcfi891VCxaejizG42678 8VsrVjQdUYw4f_gIedmYps8v.8fNivai_sh.YqBjkjLlrOqo9RufNJveWxErr1qo2uX3bBcBfEx6 CgngFs1F5tAfK5GOrK9q4WSjeCyqfNxWSr8PrEzvhV1AQMRcmw1iYXrzjHOH.hxOndEsZzTD6RJb kni5D6DhZTF34OSxMvDDwp.htKaDCcDJMDGAt2Z_JHpOxMKYQ7QY6h.oqjDofSUVN0maHt4maiS0 rN4MAQ2Xrw.ZOba3GOxwu53j8fDKsmP0ff6Bo1Z.XsdswCFEWUjQCJULMip1Q0JhbnrhCnO_CZ5f UK2IFLOKC5g-- cc: zsh-workers@zsh.org In-reply-to: <1521677761.733146.1311682464.6E0369B0@webmail.messagingengine.com> From: Oliver Kiddle References: <1519750495.1943824.1285291424.7F4B6205@webmail.messagingengine.com> <25628.1521677380@thecus> <1521677761.733146.1311682464.6E0369B0@webmail.messagingengine.com> To: Chris Lamb Subject: Re: Please make "apt install " completion work on "local" .deb files MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27488.1521711405.1@thecus> Date: Thu, 22 Mar 2018 10:36:45 +0100 Message-ID: <27489.1521711405@thecus> Chris Lamb wrote: > > No, only install for the filename case. Thanks for the quick answer. A patch follows. > > Is any path valid, just so long as it contains at least one slash? Or does > > it have to be something like "./"? > > Has to be "./" :-) That's unusual. At least we don't need both files and packages mixed for completion which is a good thing. This patch allows stuff like ./dir/zsh.deb or ./../../somewhere/zsh.deb. Are those valid? If it is strictly current directory only, this might need _path_files instead of _files. Is the same feature applicable to apt-get or aptitude? I've also corrected the tag/description mixup for the release names and package versions and made / or = auto-remove the space suffix after package names. Oliver diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt index aabe03d3c..25461c48c 100644 --- a/Completion/Debian/Command/_apt +++ b/Completion/Debian/Command/_apt @@ -408,12 +408,13 @@ _apt-cmd () { /$'policy\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \ /$'update\0'/ \| \ \( \ - /$'install\0'\|$'download\0'\|$'source\0'\|$'build-dep\0'/ \ - /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \ - \( \ - /$'[^\0/]#/'/ /$'[^\0/]#\0'/ ':release name::_apt_releases' \| \ - /$'[^\0=]#='/ /$'[^\0=]#\0'/ ':package version::_apt_versions_of_binary_package' \ - \) \ + /$'(install|download|source|build-dep)\0'/ -'subcmd=${match%?}' \ + /$'[^\0]#\0'/ ':packages::_deb_packages -qr "\n\t\- /=" "$expl_packages[@]" avail' \# \ + \( \ + /.\// -'[[ $subcmd = install ]]' /'[]'/ ':files:package file:_files -g "*.deb(-.)"' \| \ + /$'[^\0/=]#\/'/ /'[]'/ ':apt-releases:release name:_apt_releases' \| \ + /$'[^\0/=]#='/ /'[]'/ ':apt-package-versions:package version:_apt_versions_of_binary_package' \| \ + \) \ \) \| \ /$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ /$'purge\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ @@ -427,7 +428,7 @@ _apt-cmd () { /"[]"/ ':argument-1::compadd "$expl_action[@]" list search showsrc show depends rdepends policy update install download source build-dep remove upgrade full-upgrade dist-upgrade edit-sources autoclean changelog autoremove purge' _apt-cmd () { - local expl_action expl_packages + local expl_action expl_packages subcmd _description actions expl_action 'action' _description packages expl_packages 'package' @@ -475,11 +476,11 @@ _apt-get () { /$'upgrade\0'/ \| \ \( \ /$'install\0'\|$'download\0'\|$'source\0'\|$'build-dep\0'/ \ - /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \ - \( \ - /$'[^\0/]#/'/ /$'[^\0/]#\0'/ ':release name::_apt_releases' \| \ - /$'[^\0=]#='/ /$'[^\0=]#\0'/ ':package version::_apt_versions_of_binary_package' \ - \) \ + /$'[^\0]#\0'/ ':packages::_deb_packages -qr "\n\t\- /=" "$expl_packages[@]" avail' \# \ + \( \ + /$'[^\0/=]#/'/ /'[]'/ ':apt-releases:release name:_apt_releases' \| \ + /$'[^\0/=]#='/ /'[]'/ ':apt-package-versions:package version:_apt_versions_of_binary_package' \ + \) \ \) \| \ /$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ /$'purge\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ @@ -662,7 +663,7 @@ _apt_versions_of_binary_package() { done done - _describe -t apt-package-versions "package versions" kv "$@" + _describe -t apt-package-versions 'package version' kv "$@" } _apt_caching_policy () {