Skip to content

Commit a731bfd

Browse files
committed
feat(apt-get): prefer apt-cache in same dir as command
1 parent a46ccf1 commit a731bfd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

completions/apt-get

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ _comp_cmd_apt_get()
3434
_comp_xfunc_apt_get_installed_packages
3535
;;
3636
source)
37+
# Prefer `apt-cache` in the same dir as command
38+
local pathcmd
39+
pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH
3740
COMPREPLY=($(_comp_xfunc apt-cache packages)
3841
$(compgen -W "$(apt-cache dumpavail |
3942
awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$cur"))
@@ -78,6 +81,9 @@ _comp_cmd_apt_get()
7881
return
7982
;;
8083
--target-release | --default-release | -${noargopts}t)
84+
# Prefer `apt-cache` in the same dir as command
85+
local pathcmd
86+
pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH
8187
COMPREPLY=($(compgen -W "$(apt-cache policy | command sed -ne \
8288
's/^ *release.*[ ,]o=\(Debian\|Ubuntu\),a=\(\w*\).*/\2/p')" \
8389
-- "$cur"))

0 commit comments

Comments
 (0)