From 4253e056d864006b889a3e4eae2a8036b06e850d Mon Sep 17 00:00:00 2001 From: ianmacd <> Date: Sun, 4 Nov 2001 23:11:48 +0000 Subject: [PATCH] _rpm now uses /var/log/rpmpkgs if available (in RHL 7.2), since this is much faster than rpm -qa, at the expense of actuality _man completion now looks at section 'l' (local) of the manual --- bash_completion | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bash_completion b/bash_completion index dfd03a30..28d76539 100644 --- a/bash_completion +++ b/bash_completion @@ -2,7 +2,7 @@ # # # @@ -273,7 +273,7 @@ _man() # default completion if parameter contains / or we have no man.config [[ "$cur" == /* ]] || [ ! -f /etc/man.config ] && return 0 - if [[ "$prev" == [0-9n] ]]; then + if [[ "$prev" == [0-9ln] ]]; then # churn out a string of paths to search, with * appended to $cur cmd=`awk '{if ($1 ~ /^MANPATH/) \ print $(NF)"/man'$prev'/'$cur'*"}' /etc/man.config | \ @@ -296,7 +296,7 @@ _man() COMPREPLY=( $( eval $cmd ) ) COMPREPLY=( ${COMPREPLY[@]##*/} ) COMPREPLY=( ${COMPREPLY[@]%.gz} ) - COMPREPLY=( ${COMPREPLY[@]%.*} $( compgen -G $cur\*.[0-9n] ) ) + COMPREPLY=( ${COMPREPLY[@]%.*} $( compgen -G $cur\*.[0-9ln] ) ) fi return 0 @@ -565,8 +565,14 @@ _rpm() add_package_list() { - COMPREPLY=( ${COMPREPLY[@]} $( rpm -qa | \ - sed -ne 's/^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.]\+$/\1/p' ) ) + if [ -f /var/log/rpmpkgs ]; then + # using RHL 7.2 - this is quicker than querying the DB + COMPREPLY=( ${COMPREPLY[@]} + $( sed -ne 's/^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.]\+.*\.rpm$/\1/p' /var/log/rpmpkgs ) ) + else + COMPREPLY=( ${COMPREPLY[@]} $( rpm -qa | \ + sed -ne 's/^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.]\+$/\1/p' ) ) + fi } file_glob()