summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Bock <christopher@bocki.com>2026-04-30 19:39:52 +0200
committerOliver Kiddle <opk@zsh.org>2026-04-30 21:19:01 +0200
commitc26e702ff7b28b388c86ec7eb2f3d5c8304e2b85 (patch)
treeb3c548daedb590b806889c928cf043f6da6261a8
parentunposted: nedit-client is also commonly used as as the name for nc (diff)
downloadzsh-c26e702ff7b28b388c86ec7eb2f3d5c8304e2b85.tar
zsh-c26e702ff7b28b388c86ec7eb2f3d5c8304e2b85.tar.gz
zsh-c26e702ff7b28b388c86ec7eb2f3d5c8304e2b85.tar.bz2
zsh-c26e702ff7b28b388c86ec7eb2f3d5c8304e2b85.tar.lz
zsh-c26e702ff7b28b388c86ec7eb2f3d5c8304e2b85.tar.xz
zsh-c26e702ff7b28b388c86ec7eb2f3d5c8304e2b85.tar.zst
zsh-c26e702ff7b28b388c86ec7eb2f3d5c8304e2b85.zip
github #168: complete apt history commands
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Debian/Command/_apt10
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b193e2da..aa8f0f655 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2026-04-30 Oliver Kiddle <opk@zsh.org>
+ * Christopher Bock: github #168: Completion/Debian/Command/_apt:
+ add apt history commands
+
* unposted: Completion/X/Command/_nedit: nedit-client is
also commonly used as as the name for nc
diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index 19c2dfc8c..ac3095a4d 100644
--- a/Completion/Debian/Command/_apt
+++ b/Completion/Debian/Command/_apt
@@ -468,7 +468,9 @@ _apt-cmd () {
/$'full-upgrade\0'/ \| \
/$'dist-upgrade\0'/ \| \
/$'edit-sources\0'/ /$'[^\0]#\0'/ ': ::_apt_sources' \# \| \
- /"[]"/ ':argument-1::compadd "$expl_action[@]" list search showsrc show depends rdepends policy update install reinstall download source build-dep remove upgrade full-upgrade dist-upgrade edit-sources autoclean changelog autopurge autoremove purge why why-not'
+ /$'history-list\0'/ \| \
+ /$'(history-(info|redo|undo|rollback))\0'/ /$'[^\0]#\0'/ ': ::_apt_history_ids' \# \| \
+ /"[]"/ ':argument-1::compadd "$expl_action[@]" list search showsrc show depends rdepends policy update install reinstall download source build-dep remove upgrade full-upgrade dist-upgrade edit-sources autoclean changelog autopurge autoremove purge why why-not history-list history-info history-redo history-undo history-rollback'
_apt-cmd () {
local expl_action expl_packages subcmd
@@ -793,4 +795,10 @@ _apt_snapshot_dates() {
_wanted list expl 'wayback date (yyyymmdd[ThhmmssZ])' compadd -- $dates
}
+_apt_history_ids() {
+ local -a expl historyids
+ historyids=( ${${${(f)"$(_call_program history-ids apt history-list)"}:#ID*}%% *} )
+ _wanted history-ids expl 'history id' compadd -o numeric,reverse -a historyids
+}
+
_apt "$@"