Skip to content

Commit

Permalink
feat(apt-get): prefer apt-cache in same dir as command
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 23, 2023
1 parent a46ccf1 commit a731bfd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions completions/apt-get
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit a731bfd

Please sign in to comment.