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' \# \| \