2011-11-01 22:14:45 +02:00
|
|
|
# bash shell function completion -*- shell-script -*-
|
2011-10-12 23:01:10 +03:00
|
|
|
|
|
|
|
_function()
|
|
|
|
{
|
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
|
|
|
|
|
|
|
if [[ $1 == @(declare|typeset) ]]; then
|
2011-11-09 23:28:11 +02:00
|
|
|
if [[ $prev == -f ]]; then
|
2011-10-12 23:01:10 +03:00
|
|
|
COMPREPLY=( $( compgen -A function -- "$cur" ) )
|
|
|
|
elif [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) )
|
|
|
|
fi
|
2011-11-09 23:28:11 +02:00
|
|
|
elif [[ $cword -eq 1 ]]; then
|
2011-10-12 23:01:10 +03:00
|
|
|
COMPREPLY=( $( compgen -A function -- "$cur" ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( "() $( type -- ${words[1]} | sed -e 1,2d )" )
|
|
|
|
fi
|
|
|
|
} &&
|
|
|
|
complete -F _function function declare typeset
|
|
|
|
|
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|