3 # completion for the mcollective cli.
5 # for the main mco application it will complete
6 # the list of available applications
8 # for the rpc application it will complete first
9 # the list of agents, then actions and then each
12 # For all other applications it will just complete
13 # the common command line options, to add another
14 # application simply define a function called
15 # _mco_application_foo() for the foo application
18 if (( CURRENT > 2 )); then
19 local application=${words[2]}
23 args=({-W,--with}'[Combined class and fact filter]' \
24 {-S,--select}'[Select filter]' \
25 {-F,--wf,--with-fact}'[Fact filter]' \
26 {-C,--wc,--with-class}'[Class filter]' \
27 {-A,--wa,--with-agent}'[Agent filter]' \
28 {-I,--wi,--with-identity}'[Identity filter]' \
29 {-T,--target}'[Target collective]' \
30 {--dm,--disc-method}'[Which discovery method to use]' \
31 {--do,--disc-option}'[Options to pass to the discovery method]' \
32 {--dt,--discovery-timeout}'[Discovery timeout]' \
33 {-t,--timeout}'[Command Timeout]' \
34 {-q,--quiet}'[Surpress verbose output]' \
35 {-c,--config}'[Path to the config file]' \
36 {-v,--verbose}'[Be verbose]' \
37 {-h,--help}'[Show complete help message]' \
38 '--nodes[List of nodes to address]' \
39 '--ttl[Time To Live for the request]' \
40 '--reply-to[Custom reply target]')
42 curcontext="${curcontext%:*:*}:mco-${application}"
44 if (( $+functions[_mco_application_$application] > 0 ));then
45 _mco_application_$application
51 _call_program mco-list-applications mco completion --list-applications -v | while read -A hline; do
52 cmdlist=($cmdlist "${hline}")
55 curcontext="${curcontext%:*:*}:mco-applications"
57 _describe -t mco-application 'MCollective applications' cmdlist
61 _mco_application_rpc() {
64 if (( CURRENT == 3 )); then
65 _call_program mco-list-agents mco completion --list-agents -v | while read -A hline; do
66 clist=($clist "${hline}")
69 _describe -t mco-agents "MCollective agents" clist
70 elif (( CURRENT == 4 )); then
71 _call_program mco-list-actions mco completion --list-actions --agent=${words[2]} -v | while read -A hline; do
72 clist=($clist "${hline}")
75 _describe -t mco-actions "${words[2]} actions" clist
77 elif (( CURRENT > 4 )); then
78 _call_program mco-list-inputs mco completion --list-inputs --action=${words[3]} --agent=${words[2]} -v | while read hline; do
82 _describe -t mco-inputs "${words[3]} inputs" clist -S =
86 {--np,--no-progress}'[Do not show the progress bar]' \
87 {--nr,--no-results}'[Do not process results, just send request]' \
88 {-1,--one}'[Send request to only one discovered node]' \
89 '--batch[Do request in batches]' \
90 '--batch-sleep[Sleep time between batches]' \
91 {--ln,--limit-nodes}'[Only send the request to a certain number of discovered nodes]' \
92 {-j,--json}'[Output result as JSON data]'