1 | _mrt() {
|
2 | local cur prev commands
|
3 | COMPREPLY=()
|
4 | cur="${COMP_WORDS[COMP_CWORD]}"
|
5 | prev="${COMP_WORDS[COMP_CWORD-1]}"
|
6 |
|
7 | commands=" \
|
8 | help \
|
9 | run \
|
10 | create \
|
11 | deploy \
|
12 | logs \
|
13 | update \
|
14 | add \
|
15 | remove \
|
16 | list \
|
17 | mongo \
|
18 | reset \
|
19 | bundle"
|
20 |
|
21 | case "${prev}" in
|
22 | --example)
|
23 | local examples=" \
|
24 | leaderboard \
|
25 | parties \
|
26 | todos \
|
27 | wordplay"
|
28 |
|
29 | COMPREPLY=($(compgen -W "${examples}" -- ${cur}))
|
30 | return 0
|
31 | ;;
|
32 |
|
33 | run)
|
34 | local run=" \
|
35 | -p \
|
36 | --port \
|
37 | --production"
|
38 |
|
39 | COMPREPLY=($(compgen -W "${run}" -- ${cur}))
|
40 | return 0
|
41 | ;;
|
42 |
|
43 | create)
|
44 | local create=" \
|
45 | --example \
|
46 | --list \
|
47 | --branch \
|
48 | --tag \
|
49 | --ref"
|
50 |
|
51 | COMPREPLY=($(compgen -W "${create}" -- ${cur}))
|
52 | return 0
|
53 | ;;
|
54 |
|
55 | deploy)
|
56 | local deploy=" \
|
57 | -P \
|
58 | -D \
|
59 | --password \
|
60 | --delete \
|
61 | --settings \
|
62 | --debug"
|
63 |
|
64 | COMPREPLY=($(compgen -W "${deploy}" -- ${cur}))
|
65 | return 0
|
66 | ;;
|
67 |
|
68 | update)
|
69 | local update=" \
|
70 | --release"
|
71 |
|
72 | COMPREPLY=($(compgen -W "${update}" -- ${cur}))
|
73 | return 0
|
74 | ;;
|
75 |
|
76 | add)
|
77 | local add=" \
|
78 | --version"
|
79 |
|
80 | COMPREPLY=($(compgen -W "${add}" -- ${cur}))
|
81 | return 0
|
82 | ;;
|
83 |
|
84 | list)
|
85 | local list=" \
|
86 | --using"
|
87 |
|
88 | COMPREPLY=($(compgen -W "${list}" -- ${cur}))
|
89 | return 0
|
90 | ;;
|
91 |
|
92 | mongo)
|
93 | local mongo=" \
|
94 | -U \
|
95 | --url"
|
96 |
|
97 | COMPREPLY=($(compgen -W "${mongo}" -- ${cur}))
|
98 | return 0
|
99 | ;;
|
100 | esac
|
101 |
|
102 | COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
103 | return 0
|
104 | }
|
105 |
|
106 | complete -F _mrt mrt
|