From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Chris Lamb <lamby@debian.org>
Cc: zsh-workers@zsh.org
Subject: Re: Please make "apt install <tab>" completion work on "local" .deb files
Date: Thu, 22 Mar 2018 10:36:45 +0100 [thread overview]
Message-ID: <27489.1521711405@thecus> (raw)
In-Reply-To: <1521677761.733146.1311682464.6E0369B0@webmail.messagingengine.com>
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 () {
next prev parent reply other threads:[~2018-03-22 12:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 16:54 Chris Lamb
2018-03-22 0:09 ` Oliver Kiddle
2018-03-22 0:16 ` Chris Lamb
2018-03-22 9:36 ` Oliver Kiddle [this message]
2018-03-22 15:34 ` Chris Lamb
2018-04-03 7:58 ` Chris Lamb
2018-04-05 9:47 ` Oliver Kiddle
2018-04-05 9:53 ` Chris Lamb
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=27489.1521711405@thecus \
--to=okiddle@yahoo.co.uk \
--cc=lamby@debian.org \
--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).