info: Add option completion support.

This commit is contained in:
Ville Skyttä 2011-04-28 20:56:59 +03:00
parent 0c810d1471
commit f8de014a3e

View File

@ -5,16 +5,40 @@ have info || return
_info()
{
local cur prev words cword
_init_completion || return
_init_completion -n = || return
_expand || return 0
local split=false
_split_longopt && split=true
# default completion if parameter looks like a path
if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir
return 0
fi
case $prev in
-k|--apropos|--index-search|-n|--node)
return
;;
-d|--directory)
_filedir -d
return
;;
--dribble|-f|--file|-o|--output|--restore)
_filedir
return
;;
esac
$split && return
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return
fi
local i infopath=/usr/share/info
if [ "${INFOPATH: -1:1}" == ':' ]; then