summaryrefslogtreecommitdiff
path: root/completions/bash
diff options
context:
space:
mode:
authorChristopher Bock <christopher@bocki.com>2025-10-02 15:53:33 +0200
committerJulian Andres Klode <jak@debian.org>2026-01-05 21:23:52 +0000
commit2aa2677ab9ad63252acc1ddea20119101d92eb45 (patch)
tree7e472b49f4806911f7ed770291230177344bd7e8 /completions/bash
parentc43959d80b18273019d55218f4312741d17132d6 (diff)
completion: history
* complete command history-(list|info|undo|redo|rollback). complete the history-id for all but commands but history-list. set complet -o nosort to get the history-ids in a reverse order.
Diffstat (limited to 'completions/bash')
-rw-r--r--completions/bash/apt12
1 files changed, 10 insertions, 2 deletions
diff --git a/completions/bash/apt b/completions/bash/apt
index 571c6663b..3bd705a98 100644
--- a/completions/bash/apt
+++ b/completions/bash/apt
@@ -1,4 +1,5 @@
# Debian apt(8) completion -*- shell-script -*-
+# shellcheck shell=bash
_apt()
{
@@ -49,6 +50,7 @@ _apt()
"download" "changelog"
"moo"
"modernize-sources"
+ "history-list" "history-info" "history-undo" "history-redo" "history-rollback"
"depends" "rdepends" "why" "why-not"
"policy")
@@ -94,7 +96,7 @@ _apt()
return 0
;;
list)
- COMPREPLY=( $( compgen -W '--installed --upgradable
+ COMPREPLY=( $( compgen -W '--installed --upgradable
--manual-installed
-v --verbose
-a --all-versions
@@ -235,6 +237,12 @@ _apt()
-- "$cur" ) )
return 0
;;
+ history-info|history-rollback|history-redo|history-undo)
+ local _historyids=$( apt history-list |
+ awk '/^(ID|$)/{next};{print$1}' |tac 2> /dev/null )
+ COMPREPLY=( $( compgen -W "${_historyids[@]}" -- "$cur" ) )
+ return 0
+ ;;
moo)
COMPREPLY=( $( compgen -W 'moo' \
-- "$cur" ) )
@@ -248,6 +256,6 @@ _apt()
return 0
} &&
-complete -F _apt apt
+complete -o nosort -F _apt apt
# ex: ts=4 sw=4 et filetype=sh