summaryrefslogtreecommitdiff
path: root/completions/apt-cache
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.net.br>2019-08-07 09:17:13 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.net.br>2019-08-07 09:17:13 -0300
commit5732da2af736c40cf693354485446ab4867ecb4d (patch)
tree76d76cdfa16ca62d20fb109da13895ec64fff110 /completions/apt-cache
parent9cd22d1df8f0f5b554858471c86faa9f37b8fed4 (diff)
downloadbash-completion-5732da2af736c40cf693354485446ab4867ecb4d.tar.gz
New upstream version 2.9upstream/2.9
Diffstat (limited to 'completions/apt-cache')
-rw-r--r--completions/apt-cache21
1 files changed, 11 insertions, 10 deletions
diff --git a/completions/apt-cache b/completions/apt-cache
index bedae4e9..5bd85e90 100644
--- a/completions/apt-cache
+++ b/completions/apt-cache
@@ -2,17 +2,18 @@
# List APT binary packages
_apt_cache_packages() {
- apt-cache --no-generate pkgnames "$cur" 2> /dev/null
+ apt-cache --no-generate pkgnames "$cur" 2>/dev/null
}
# List APT source packages
_apt_cache_sources() {
- apt-cache dumpavail | command grep "^Source: $1" | cut -f2 -d" " | sort -u
+ compgen -W "$(apt-cache dumpavail | \
+ awk '$1 == "Source:" { print $2 }' | sort -u)" -- "$1"
}
# List APT source packages
_apt_cache_src_packages() {
- compgen -W '$( _apt_cache_sources "$cur" )' -- "$cur"
+ compgen -W '$(_apt_cache_sources "$cur")' -- "$cur"
}
_apt_cache()
@@ -37,11 +38,11 @@ _apt_cache()
;;
showsrc)
- COMPREPLY=( $( _apt_cache_sources "$cur" ) )
+ COMPREPLY=( $(_apt_cache_sources "$cur") )
;;
*)
- COMPREPLY=( $( _apt_cache_packages ) )
+ COMPREPLY=( $(_apt_cache_packages) )
;;
esac
@@ -50,7 +51,7 @@ _apt_cache()
case $prev in
- -c|-p|-s|--config-file|--pkg-cache|--src-cache)
+ --config-file|--pkg-cache|--src-cache|-!(-*)[cps])
_filedir
return
;;
@@ -63,16 +64,16 @@ _apt_cache()
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c -o --help
+ COMPREPLY=( $(compgen -W '-h -v -p -s -q -i -f -a -g -c -o --help
--version --pkg-cache --src-cache --quiet --important --full
--all-versions --no-all-versions --generate --no-generate
--names-only --all-names --recurse --config-file --option
- --installed' -- "$cur" ) )
+ --installed' -- "$cur") )
else
- COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc stats
+ COMPREPLY=( $(compgen -W 'add gencaches show showpkg showsrc stats
dump dumpavail unmet search search depends rdepends pkgnames
- dotty xvcg policy madison' -- "$cur" ) )
+ dotty xvcg policy madison' -- "$cur") )
fi