2010-01-08 22:47:41 +00:00
|
|
|
# bash completion for rebar
|
|
|
|
|
|
|
|
_rebar()
|
|
|
|
{
|
2010-01-09 17:24:08 +00:00
|
|
|
local cur prev sopts lopts cmdsnvars
|
2010-01-08 22:47:41 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
2010-05-03 09:38:27 +00:00
|
|
|
sopts="-h -c -v -V -f -j"
|
|
|
|
lopts=" --help --commands --verbose --force --jobs= --version"
|
2012-05-18 17:57:57 +00:00
|
|
|
cmdsnvars="check-deps clean compile create create-app create-node ct \
|
|
|
|
doc delete-deps escriptize eunit get-deps generate generate-upgrade \
|
2011-10-20 18:56:34 +00:00
|
|
|
help list-deps list-templates update-deps version xref overlay \
|
2012-01-06 17:33:41 +00:00
|
|
|
apps= case= force=1 jobs= suites= verbose=1 appid= previous_release= \
|
2012-05-13 17:26:29 +00:00
|
|
|
nodeid= root_dir= skip_deps=true skip_apps= template= template_dir="
|
2010-01-08 22:47:41 +00:00
|
|
|
|
|
|
|
if [[ ${cur} == --* ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
|
|
|
|
elif [[ ${cur} == -* ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
|
|
|
|
fi
|
2010-01-10 09:38:05 +00:00
|
|
|
|
|
|
|
if [ -n "$COMPREPLY" ] ; then
|
|
|
|
# append space if matched
|
|
|
|
COMPREPLY="${COMPREPLY} "
|
|
|
|
# remove trailing space after equal sign
|
|
|
|
COMPREPLY=${COMPREPLY/%= /=}
|
|
|
|
fi
|
|
|
|
return 0
|
2010-01-08 22:47:41 +00:00
|
|
|
}
|
2010-01-09 17:24:08 +00:00
|
|
|
complete -o nospace -F _rebar rebar
|
2010-01-08 22:47:41 +00:00
|
|
|
|
|
|
|
# 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
|