From a731bfd0acf77c7e5ec52315e3b470cffa177b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 23 May 2023 14:18:05 +0300 Subject: [PATCH] feat(apt-get): prefer `apt-cache` in same dir as command --- completions/apt-get | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/completions/apt-get b/completions/apt-get index 358fa30122b..e1606a2f5fb 100644 --- a/completions/apt-get +++ b/completions/apt-get @@ -34,6 +34,9 @@ _comp_cmd_apt_get() _comp_xfunc_apt_get_installed_packages ;; source) + # Prefer `apt-cache` in the same dir as command + local pathcmd + pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH COMPREPLY=($(_comp_xfunc apt-cache packages) $(compgen -W "$(apt-cache dumpavail | awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$cur")) @@ -78,6 +81,9 @@ _comp_cmd_apt_get() return ;; --target-release | --default-release | -${noargopts}t) + # Prefer `apt-cache` in the same dir as command + local pathcmd + pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH COMPREPLY=($(compgen -W "$(apt-cache policy | command sed -ne \ 's/^ *release.*[ ,]o=\(Debian\|Ubuntu\),a=\(\w*\).*/\2/p')" \ -- "$cur"))