_function(): declare won't allow a function that starts with a '-', so use

type instead
This commit is contained in:
ianmacd 2002-02-20 00:12:52 +00:00
parent 96860dc0e5
commit 4351ae5a0b

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.134 2002/02/19 22:49:13 ianmacd Exp $ # $Id: bash_completion,v 1.135 2002/02/20 01:12:52 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1883,7 +1883,7 @@ _function()
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $(compgen -A function $cur ) ) COMPREPLY=( $(compgen -A function $cur ) )
else else
COMPREPLY=( "() $( declare -f ${COMP_WORDS[1]} | sed -e 1d )" ) COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
fi fi
} }
complete -F _function function complete -F _function function