Merge 'upstream/saas-4' into saas-4
[odoo/odoo.git] / oe-bash-completion
1 _oe()
2 {
3     local cur prev opts
4     COMPREPLY=()
5     cur="${COMP_WORDS[COMP_CWORD]}"
6     prev="${COMP_WORDS[COMP_CWORD-1]}"
7
8     cmd="${COMP_WORDS[0]}"
9     subcmd=""
10     if [[ ${COMP_CWORD} > 0 ]] ; then
11         subcmd="${COMP_WORDS[1]}"
12     fi
13
14     # oe
15
16     opts="initialize model read run-tests scaffold update \
17         call open show consume-nothing consume-memory leak-memory \
18         consume-cpu bench-read bench-fields-view-get bench-dummy bench-login \
19         bench-sale-mrp --help"
20
21     if [[ ${prev} == oe && ${cur} != -* ]] ; then
22         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
23         return 0
24     fi
25
26     # oe call
27
28     opts="--database --user --password --host --port --help"
29
30     if [[ ${subcmd} == call ]] ; then
31         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
32         return 0
33     fi
34
35     # oe initialize
36
37     opts="--database --addons --all-modules --exclude --no-create --help"
38
39     if [[ ${subcmd} == initialize ]] ; then
40         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
41         return 0
42     fi
43
44     # oe model
45
46     opts="--database --model --field --verbose --help"
47
48     if [[ ${subcmd} == model ]] ; then
49         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
50         return 0
51     fi
52
53     # oe read
54
55     opts="--database --model --id --field --verbose --short --help"
56
57     if [[ ${subcmd} == read ]] ; then
58         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
59         return 0
60     fi
61
62     # oe run-tests
63
64     opts="--database --addons --module --dry-run --help"
65
66     if [[ ${subcmd} == run-tests ]] ; then
67         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
68         return 0
69     fi
70
71     # oe scaffold
72
73     opts="--help"
74
75     if [[ ${subcmd} == scaffold ]] ; then
76         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
77         return 0
78     fi
79
80     # fallback for unimplemented completion
81
82     opts="--help"
83
84     if [[ true ]] ; then
85         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
86         return 0
87     fi
88 }
89 complete -F _oe oe