Simplified bash-completion script

This commit is contained in:
Tuncer Ayaz 2010-01-10 10:38:05 +01:00
parent 59bfc5044f
commit ba306ec183

View file

@ -15,30 +15,19 @@ _rebar()
if [[ ${cur} == --* ]] ; then
COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
if [ -n "$COMPREPLY" ] ; then
# append space if matched
COMPREPLY="${COMPREPLY} "
# remove trailing space if --lopt=value option
COMPREPLY=${COMPREPLY/%= /=}
fi
return 0
elif [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
if [ -n "$COMPREPLY" ] ; then
# append space if matched
COMPREPLY="${COMPREPLY} "
fi
return 0
else
COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
if [ -n "$COMPREPLY" ] ; then
# append space if matched
COMPREPLY="${COMPREPLY} "
# remove trailing space if var= option
COMPREPLY=${COMPREPLY/%= /=}
fi
return 0
fi
if [ -n "$COMPREPLY" ] ; then
# append space if matched
COMPREPLY="${COMPREPLY} "
# remove trailing space after equal sign
COMPREPLY=${COMPREPLY/%= /=}
fi
return 0
}
complete -o nospace -F _rebar rebar