rebar/priv/shell-completion/bash/rebar
2010-01-10 10:38:05 +01:00

40 lines
1.1 KiB
Bash

# bash completion for rebar
_rebar()
{
local cur prev sopts lopts cmdsnvars
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
sopts="-h -v -f -j"
lopts=" --help --verbose --force --jobs="
cmdsnvars="analyze build_plt check_plt clean compile \
create-app create-node eunit generate \
int_test perf_test test \
case= force=1 jobs= suite= verbose=1"
if [[ ${cur} == --* ]] ; then
COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
elif [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
else
COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
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
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh