rebar/priv/shell-completion/bash/rebar
Tuncer Ayaz 77a0eb6fe4 Fix #56 (always-on recursion)
Always-on recursive application of all rebar commands causes too many
issues. Recursive application is required for:
1. dealing with dependencies: get-deps, update-deps, and compile of deps
   right after get-deps or update-deps
2. projects with a riak-like apps/ project structure and dev process

The vast majority of projects are not structured like riak. Therefore,
moving forward it's best to (by default) restrict recursive behavior to
dealing with deps. This commit does that and also adds command line and
rebar.config options for controlling or configuring recursion. Also, we
introduce two meta commands: prepare-deps (equivalent to rebar -r
get-deps compile) and refresh-deps (equivalent to rebar -r update-deps
compile). riak-like projects can extend the list of recursive commands
(to include 'eunit' and 'compile') by adding
{recursive_cmds, [eunit, compile]} to rebar.config.
2014-03-11 21:11:36 +00:00

89 lines
1.9 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 -c -v -V -f -D -j -C -p -k -r"
lopts="--help \
--commands \
--verbose \
--force \
--jobs \
--config \
--profile \
--keep-going \
--recursive \
--version"
cmdsnvars="check-deps \
clean \
compile \
create \
create-app \
create-lib \
create-node \
ct \
doc \
delete-deps \
escriptize \
eunit \
get-deps \
generate \
generate-appups \
generate-upgrade \
help \
list-deps \
list-templates \
prepare-deps \
qc \
refresh-deps \
update-deps \
version \
xref \
overlay \
apps= \
case= \
dump_spec=1 \
force=1 \
jobs= \
suites= \
verbose=1 \
appid= \
overlay_vars= \
previous_release= \
nodeid= \
root_dir= \
skip_deps=true \
skip_apps= \
target_dir= \
template= \
template_dir= \
tests="
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