- fix for dpkg completion (patch by Itay Ben-Yaacov <nib_maps@yahoo.com>)

This commit is contained in:
ianmacd 2004-07-05 21:45:00 +00:00
parent 85948e9a64
commit 1aad49138d

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05b
#
# $Id: bash_completion,v 1.733 2004/07/05 23:35:36 ianmacd Exp $
# $Id: bash_completion,v 1.734 2004/07/05 23:45:00 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -3449,19 +3449,20 @@ _comp-dpkg-installed-packages()
#
_dpkg()
{
local cur prev
local cur prev i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
i=$COMP_CWORD
_expand || return 0
# find the last option flag
if [[ $cur != -* ]]; then
while [[ $prev != -* && $COMP_CWORD != 1 ]]; do
COMP_CWORD=$((COMP_CWORD-1))
prev=${COMP_WORDS[COMP_CWORD-1]}
while [[ $prev != -* && $i != 1 ]]; do
i=$((i-1))
prev=${COMP_WORDS[i-1]}
done
fi