* Please make "apt install <tab>" completion work on "local" .deb files
@ 2018-02-27 16:54 Chris Lamb
2018-03-22 0:09 ` Oliver Kiddle
0 siblings, 1 reply; 8+ messages in thread
From: Chris Lamb @ 2018-02-27 16:54 UTC (permalink / raw)
To: zsh-workers
Hi!
Please make "apt install <tab>" completion work on local .deb
files. For example, given a "foo_1.0_amd64.deb" in the current
directory:
$ sudo apt install ./f<TAB>
… should expand to:
$ sudo apt install ./foo_1.0_amd64.deb
It probably wants to be limited to .deb files so it doesn't trigger
for the usual use-cases of installing packages from APT. Note that
"apt install" really does need a path-ish, ie:
$ apt install ./foo.deb
ie. not simply doing
$ apt install foo.deb
(ie. a "naive" _files will not be correct)
I did try adding this myself but my zsh completion fu is clearly
not up to the task and I originally filed this in Debian here but
it was suggested I take it upstream:
https://bugs.debian.org/891140
Thanks in advance :)
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org / chris-lamb.co.uk
`-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Please make "apt install <tab>" completion work on "local" .deb files
2018-02-27 16:54 Please make "apt install <tab>" completion work on "local" .deb files Chris Lamb
@ 2018-03-22 0:09 ` Oliver Kiddle
2018-03-22 0:16 ` Chris Lamb
0 siblings, 1 reply; 8+ messages in thread
From: Oliver Kiddle @ 2018-03-22 0:09 UTC (permalink / raw)
To: Chris Lamb; +Cc: zsh-workers
On 27 Feb, Chris Lamb wrote:
>
> Please make "apt install <tab>" completion work on local .deb
> files. For example, given a "foo_1.0_amd64.deb" in the current
> directory:
>
> $ sudo apt install ./f<TAB>
>
> … should expand to:
>
> $ sudo apt install ./foo_1.0_amd64.deb
Is the same applicable to apt download, source and build-dep also?
Or just some subset of those?
I see it is possible to have arguments like zsh/unstable so this could
be tricky.
> It probably wants to be limited to .deb files so it doesn't trigger
> for the usual use-cases of installing packages from APT. Note that
> "apt install" really does need a path-ish, ie:
>
> $ apt install ./foo.deb
>
> ie. not simply doing
>
> $ apt install foo.deb
Is any path valid, just so long as it contains at least one slash? Or does
it have to be something like "./"?
Oliver
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Please make "apt install <tab>" completion work on "local" .deb files
2018-03-22 0:09 ` Oliver Kiddle
@ 2018-03-22 0:16 ` Chris Lamb
2018-03-22 9:36 ` Oliver Kiddle
0 siblings, 1 reply; 8+ messages in thread
From: Chris Lamb @ 2018-03-22 0:16 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Hi Oliver,
> On 27 Feb, Chris Lamb wrote:
> >
> > Please make "apt install <tab>" completion work on local .deb
> > files. For example, given a "foo_1.0_amd64.deb" in the current
> > directory:
> >
> > $ sudo apt install ./f<TAB>
> >
> > … should expand to:
> >
> > $ sudo apt install ./foo_1.0_amd64.deb
>
> Is the same applicable to apt download, source and build-dep also?
> Or just some subset of those?
No, only install for the filename case.
> 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 "./" :-)
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org / chris-lamb.co.uk
`-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Please make "apt install <tab>" completion work on "local" .deb files
2018-03-22 0:16 ` Chris Lamb
@ 2018-03-22 9:36 ` Oliver Kiddle
2018-03-22 15:34 ` Chris Lamb
0 siblings, 1 reply; 8+ messages in thread
From: Oliver Kiddle @ 2018-03-22 9:36 UTC (permalink / raw)
To: Chris Lamb; +Cc: zsh-workers
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 () {
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Please make "apt install <tab>" completion work on "local" .deb files
2018-03-22 9:36 ` Oliver Kiddle
@ 2018-03-22 15:34 ` Chris Lamb
2018-04-03 7:58 ` Chris Lamb
0 siblings, 1 reply; 8+ messages in thread
From: Chris Lamb @ 2018-03-22 15:34 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers
Dear Oliver,
> > > 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 "./"
I misspoke here - "apt install /full/path/to/filename.deb" *also*
works and is not covered by your patch, but at least we can detect
the leading "/" or ".". Indeed, I suspect this line is the relevant
one?
+ /.\// -'[[ $subcmd = install ]]' /'[]'/ ':files:package file:_files -g
> This patch allows stuff like ./dir/zsh.deb or ./../../somewhere/zsh.deb.
> Are those valid?
(Yep.)
> Is the same feature applicable to apt-get or aptitude?
(Nope. `apt` is being a bit magic here, alas.)
.. apart from that, your patch is great and works for me :)
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org / chris-lamb.co.uk
`-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Please make "apt install <tab>" completion work on "local" .deb files
2018-03-22 15:34 ` Chris Lamb
@ 2018-04-03 7:58 ` Chris Lamb
2018-04-05 9:47 ` Oliver Kiddle
0 siblings, 1 reply; 8+ messages in thread
From: Chris Lamb @ 2018-04-03 7:58 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers, 891140
[Adding 891140@ to CC; please retain in replies]
Hi Oliver,
> > .. apart from that, your patch is great and works for me :)
Thanks for applying this. I was wonder if you could also include:
*.changes
*.dsc
ie. as well as *.deb. All behaviours of path-based .debs can be
inherited. Thanks in advance :)
Best wishes,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org / chris-lamb.co.uk
`-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Please make "apt install <tab>" completion work on "local" .deb files
2018-04-03 7:58 ` Chris Lamb
@ 2018-04-05 9:47 ` Oliver Kiddle
2018-04-05 9:53 ` Chris Lamb
0 siblings, 1 reply; 8+ messages in thread
From: Oliver Kiddle @ 2018-04-05 9:47 UTC (permalink / raw)
To: Chris Lamb; +Cc: zsh-workers, 891140
Chris Lamb wrote:
>
> Thanks for applying this. I was wonder if you could also include:
>
> *.changes
> *.dsc
>
> ie. as well as *.deb. All behaviours of path-based .debs can be
> inherited. Thanks in advance :)
Do you mean like the following patch - considering all .changes and .dsc
files alongside .deb? Or in some other context?
Oliver
diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index 645b02279..dd837379c 100644
--- a/Completion/Debian/Command/_apt
+++ b/Completion/Debian/Command/_apt
@@ -411,7 +411,7 @@ _apt-cmd () {
/$'(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(-.)"' \| \
+ // '%(.|)/%' -'[[ $subcmd = install ]]' /'[]'/ ':files:package file:_files -g "*.(changes|deb|dsc)(-.)"' \| \
/$'[^\0/=]#\/'/ /'[]'/ ':apt-releases:release name:_apt_releases' \| \
/$'[^\0/=]#='/ /'[]'/ ':apt-package-versions:package version:_apt_versions_of_binary_package' \| \
\) \
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Please make "apt install <tab>" completion work on "local" .deb files
2018-04-05 9:47 ` Oliver Kiddle
@ 2018-04-05 9:53 ` Chris Lamb
0 siblings, 0 replies; 8+ messages in thread
From: Chris Lamb @ 2018-04-05 9:53 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: zsh-workers, 891140
Hi Oliver,
> > I was wonder if you could also include:
> >
> > *.changes
> > *.dsc
> >
> > ie. as well as *.deb. All behaviours of path-based .debs can be
> > inherited. Thanks in advance :)
>
> Do you mean like the following patch - considering all .changes and .dsc
> files alongside .deb?
Exactly.
> - // '%(.|)/%' -'[[ $subcmd = install ]]' /'[]'/ ':files:package
> file:_files -g "*.deb(-.)"' \| \
> + // '%(.|)/%' -'[[ $subcmd = install ]]' /'[]'/ ':files:package
> file:_files -g "*.(changes|deb|dsc)(-.)"' \| \
Perfect :)
Best wishes,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org / chris-lamb.co.uk
`-
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-04-05 9:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 16:54 Please make "apt install <tab>" completion work on "local" .deb files Chris Lamb
2018-03-22 0:09 ` Oliver Kiddle
2018-03-22 0:16 ` Chris Lamb
2018-03-22 9:36 ` Oliver Kiddle
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
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).