aptitude patch to use grep-status, if available. Patch from Kyle Wheeler

<kyle@memoryhole.net>.
This commit is contained in:
ianmacd 2006-02-23 21:55:44 +00:00
parent beb78d83d4
commit 75f971a08c

View File

@ -1,6 +1,6 @@
# bash_completion - programmable completion functions for bash 3.0 # bash_completion - programmable completion functions for bash 3.0
# #
# $Id: bash_completion,v 1.835 2006/02/23 21:16:16 ianmacd Exp $ # $Id: bash_completion,v 1.836 2006/02/23 22:55:44 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -2142,11 +2142,18 @@ complete -F _apt_cache $filenames apt-cache
# Debian aptitude(1) completion # Debian aptitude(1) completion
# #
have aptitude && { have aptitude && {
have grep-status && {
_comp_dpkg_hold_packages()
{
grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
}
} || {
_comp_dpkg_hold_packages() _comp_dpkg_hold_packages()
{ {
grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \ grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \
| cut -d\ -f2 | cut -d\ -f2
} }
}
_aptitude() _aptitude()
{ {
@ -4162,11 +4169,18 @@ complete -F _cardctl cardctl
# This function is required by _dpkg() and _dpkg-reconfigure() # This function is required by _dpkg() and _dpkg-reconfigure()
# #
have dpkg && { have dpkg && {
have grep-status && {
_comp_dpkg_installed_packages()
{
grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package
}
} || {
_comp_dpkg_installed_packages() _comp_dpkg_installed_packages()
{ {
grep -A 2 "Package: $1" /var/lib/dpkg/status | \ grep -A 2 "Package: $1" /var/lib/dpkg/status | \
grep -B 2 'ok installed' | grep "Package: $1" | cut -d\ -f2 grep -B 2 'ok installed' | grep "Package: $1" | cut -d\ -f2
} }
}
# Debian dpkg(8) completion # Debian dpkg(8) completion
# #