mirror of
https://github.com/correl/rebar.git
synced 2024-11-27 11:09:55 +00:00
Simplified bash-completion script
This commit is contained in:
parent
59bfc5044f
commit
ba306ec183
1 changed files with 8 additions and 19 deletions
|
@ -15,30 +15,19 @@ _rebar()
|
||||||
|
|
||||||
if [[ ${cur} == --* ]] ; then
|
if [[ ${cur} == --* ]] ; then
|
||||||
COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
|
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
|
elif [[ ${cur} == -* ]] ; then
|
||||||
COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
|
||||||
if [ -n "$COMPREPLY" ] ; then
|
|
||||||
# append space if matched
|
|
||||||
COMPREPLY="${COMPREPLY} "
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
else
|
else
|
||||||
COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$COMPREPLY" ] ; then
|
if [ -n "$COMPREPLY" ] ; then
|
||||||
# append space if matched
|
# append space if matched
|
||||||
COMPREPLY="${COMPREPLY} "
|
COMPREPLY="${COMPREPLY} "
|
||||||
# remove trailing space if var= option
|
# remove trailing space after equal sign
|
||||||
COMPREPLY=${COMPREPLY/%= /=}
|
COMPREPLY=${COMPREPLY/%= /=}
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
complete -o nospace -F _rebar rebar
|
complete -o nospace -F _rebar rebar
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue