add bash export completion

change $cword reference to $cur in alias completion
remove local from list of built-ins that complete on variables, since local
  can't be used interactively
This commit is contained in:
ianmacd 2002-02-11 01:49:26 +00:00
parent ea10afb706
commit d51b4604ff

View File

@ -2,7 +2,7 @@
# #
# <![CDATA[ # <![CDATA[
# #
# $Id: bash_completion,v 1.99 2002/02/11 00:11:03 ianmacd Exp $ # $Id: bash_completion,v 1.100 2002/02/11 02:49:26 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -89,7 +89,7 @@ complete -A hostname ssh rsh telnet rlogin ftp ping fping host traceroute \
nslookup nslookup
# export and others complete with shell variables # export and others complete with shell variables
complete -v export local readonly unset complete -v readonly unset
# set completes with set options # set completes with set options
complete -A setopt set complete -A setopt set
@ -1681,7 +1681,7 @@ _alias()
case "$COMP_LINE" in case "$COMP_LINE" in
*[^=]) *[^=])
COMPREPLY=( $(compgen -A alias $cword) ) COMPREPLY=( $( compgen -A alias -S '=' $cur ) )
;; ;;
*=) *=)
COMPREPLY=( "$( alias ${cur%=} | \ COMPREPLY=( "$( alias ${cur%=} | \
@ -1691,6 +1691,24 @@ _alias()
} }
complete -F _alias alias complete -F _alias alias
# bash export completion
#
_export()
{
local cur
cur=${COMP_WORDS[$COMP_CWORD]};
case "$COMP_LINE" in
*[^=])
COMPREPLY=( $( compgen -v -S '=' $cur ) )
;;
*=)
COMPREPLY=( $( eval echo $`echo ${cur%=}` ) )
;;
esac
}
complete -F _export export
# bash shell function completion # bash shell function completion
# #
_function() _function()