diff options
| author | Vo Minh Thu <vmt@openerp.com> | 2013-01-11 14:46:57 +0100 |
|---|---|---|
| committer | Vo Minh Thu <vmt@openerp.com> | 2013-01-11 14:46:57 +0100 |
| commit | 3da57500c279cd19fa6d561eef149d708383138d (patch) | |
| tree | e6ea46397217349ff0381b91346a1ba02394e14b /oe-bash-completion | |
| parent | 3478333bca1a28483c1c7eb90431cb1e979c74ba (diff) | |
[ADD] oe: provides sane (unfucked) command-line interface.
The implementation is far from perfect. Some improvements are waiting in
its previous location: lp:~openerp/openerp-command.
Some docs are provided, see doc/openerp-command.rst and
doc/adding-command.rst.
bzr revid: vmt@openerp.com-20130111134657-im2f3uqjluyo4pm6
Diffstat (limited to 'oe-bash-completion')
| -rw-r--r-- | oe-bash-completion | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/oe-bash-completion b/oe-bash-completion new file mode 100644 index 00000000000..57a4391d803 --- /dev/null +++ b/oe-bash-completion @@ -0,0 +1,89 @@ +_oe() +{ + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + cmd="${COMP_WORDS[0]}" + subcmd="" + if [[ ${COMP_CWORD} > 0 ]] ; then + subcmd="${COMP_WORDS[1]}" + fi + + # oe + + opts="initialize model read run-tests scaffold update \ + call open show consume-nothing consume-memory leak-memory \ + consume-cpu bench-read bench-fields-view-get bench-dummy bench-login \ + bench-sale-mrp --help" + + if [[ ${prev} == oe && ${cur} != -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + # oe call + + opts="--database --user --password --host --port --help" + + if [[ ${subcmd} == call ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + # oe initialize + + opts="--database --addons --all-modules --exclude --no-create --help" + + if [[ ${subcmd} == initialize ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + # oe model + + opts="--database --model --field --verbose --help" + + if [[ ${subcmd} == model ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + # oe read + + opts="--database --model --id --field --verbose --short --help" + + if [[ ${subcmd} == read ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + # oe run-tests + + opts="--database --addons --module --dry-run --help" + + if [[ ${subcmd} == run-tests ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + # oe scaffold + + opts="--help" + + if [[ ${subcmd} == scaffold ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + # fallback for unimplemented completion + + opts="--help" + + if [[ true ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi +} +complete -F _oe oe |
