- _longopt(): make vague attempt at path completion after the '=' in

--long-opt= options
- _filedir(): don't bother to set $cur, since every function that calls
  it will have already set it
This commit is contained in:
ianmacd 2002-03-01 22:41:42 +00:00
parent 81decef383
commit 55f9da95c5

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05a # bash_completion - some programmable completion functions for bash 2.05a
# #
# $Id: bash_completion,v 1.172 2002/03/01 19:29:34 ianmacd Exp $ # $Id: bash_completion,v 1.173 2002/03/01 23:41:42 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1891,12 +1891,22 @@ _psql()
_longopt() _longopt()
{ {
local cur local cur opt
cur=${COMP_WORDS[COMP_CWORD]} cur=${COMP_WORDS[COMP_CWORD]}
_expand || return 0 _expand || return 0
if [[ "$cur" == --*=* ]]; then
opt=${cur%%=*}
# cut backlash that gets inserted before '=' sign
opt=${opt%\\*}
cur=${cur#*=}
_filedir
COMPREPLY=( $( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur))
return 0
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( $1 --help | sed -e '/--/!d' \ COMPREPLY=( $( $1 --help | sed -e '/--/!d' \
-e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \ -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \
@ -2122,10 +2132,7 @@ complete -F _configure_func configure
_filedir() _filedir()
{ {
local IFS cur local IFS=$'\t\n'
IFS=$'\t\n'
cur=${COMP_WORDS[COMP_CWORD]}
_expand || return 0 _expand || return 0