~openerp-community/openobject-server/fix-1130010-toxml-escape-quot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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