diff options
author | derwinlu <derwinlu+git@gmail.com> | 2015-04-01 21:45:37 +0200 |
---|---|---|
committer | derwinlu <derwinlu+git@gmail.com> | 2015-04-01 22:37:03 +0200 |
commit | 61c4d7509841cc3357cb39596957a7dd94ac5b7d (patch) | |
tree | 7e5b1847ffcd84c76ebc29e748183b57c5958623 | |
parent | 9311d9087cb604a73d67fd712c7684955ab59bfe (diff) |
implement bash autocompletion
-rw-r--r-- | priv/shell-completion/bash/rebar | 89 | ||||
-rw-r--r-- | priv/shell-completion/bash/rebar3 | 172 |
2 files changed, 172 insertions, 89 deletions
diff --git a/priv/shell-completion/bash/rebar b/priv/shell-completion/bash/rebar deleted file mode 100644 index 375566c..0000000 --- a/priv/shell-completion/bash/rebar +++ /dev/null @@ -1,89 +0,0 @@ -# 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 diff --git a/priv/shell-completion/bash/rebar3 b/priv/shell-completion/bash/rebar3 new file mode 100644 index 0000000..758deee --- /dev/null +++ b/priv/shell-completion/bash/rebar3 @@ -0,0 +1,172 @@ +# bash completion for rebar3 + +_rebar3() +{ + local cur prev sopts lopts cmdsnvars + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + if [[ ${prev} == rebar3 ]] ; then + sopts="-h -v" + lopts="--help --version" + cmdsnvars="as \ + clean \ + compile \ + cover \ + ct \ + dialyzer \ + do \ + edoc \ + escriptize \ + eunit \ + help \ + new \ + pkgs \ + release \ + shell \ + tar \ + update \ + upgrade \ + version \ + wtf \ + xref" + elif [[ ${prev} == as ]] ; then + : + elif [[ ${prev} == clean ]] ; then + sopts="-a" + lopts="--all" + elif [[ ${prev} == compile ]] ; then + : + elif [[ ${prev} == cover ]] ; then + sopts="-r -v" + lopts="--reset --verbose" + elif [[ ${prev} == ct ]] ; then + sopts="-c -v" + lopts="--dir \ + --suite \ + --group \ + --case \ + --spec \ + --join_specs \ + --label \ + --config \ + --userconfig \ + --allow_user_terms \ + --logdir \ + --logopts \ + --verbosity \ + --silent_connections \ + --stylesheet \ + --cover \ + --cover_spec \ + --cover_stop \ + --event_handler \ + --include \ + --abort_if_missing_suites \ + --multiply_timetraps \ + --scale_timetraps \ + --create_priv_dir \ + --repeat \ + --duration \ + --until \ + --force_stop \ + --basic_html \ + --ct_hooks \ + --verbose" + elif [[ ${prev} == dialyzer ]] ; then + sopts="-u -s" + lopts="--update-plt --succ-typings" + elif [[ ${prev} == do ]] ; then + : + elif [[ ${prev} == edoc ]] ; then + : + elif [[ ${prev} == escriptize ]] ; then + : + elif [[ ${prev} == eunit ]] ; then + sopts="-c -v" + lopts="--app --cover --suite --verbose" + elif [[ ${prev} == help ]] ; then + : + elif [[ ${prev} == new ]] ; then + sopts="-f" + lopts="--force" + elif [[ ${prev} == pkgs ]] ; then + : + elif [[ ${prev} == release ]] ; then + sopts="-n -v -g -u -o -h -l -p -V -d -i -a -c -r" + lopts="--relname \ + --relvsn \ + --goal \ + --upfrom \ + --output-dir \ + --help \ + --lib-dir \ + --path \ + --default-libs \ + --verbose \ + --dev-mode \ + --include-erts \ + --override \ + --config \ + --overlay_vars \ + --vm_args \ + --sys_config \ + --system_libs \ + --version \ + --root" + elif [[ ${prev} == shell ]] ; then + : + elif [[ ${prev} == tar ]] ; then + sopts="-n -v -g -u -o -h -l -p -V -d -i -a -c -r" + lopts="--relname \ + --relvsn \ + --goal \ + --upfrom \ + --output-dir \ + --help \ + --lib-dir \ + --path \ + --default-libs \ + --verbose \ + --dev-mode \ + --include-erts \ + --override \ + --config \ + --overlay_vars \ + --vm_args \ + --sys_config \ + --system_libs \ + --version \ + --root" + elif [[ ${prev} == update ]] ; then + : + elif [[ ${prev} == upgrade ]] ; then + : + elif [[ ${prev} == version ]] ; then + : + elif [[ ${prev} == wtf ]] ; then + : + elif [[ ${prev} == xref ]] ; then + : + fi + + COMPREPLY=( $(compgen -W "${sopts} ${lopts} ${cmdsnvars}" -- ${cur}) ) + + 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 _rebar3 rebar3 + +# 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 |