]>
Commit | Line | Data |
---|---|---|
3db8dd39 | 1 | _have lxc-start && { |
0306de4f SG |
2 | _lxc_names() { |
3 | COMPREPLY=( $( compgen -W "$( lxc-ls )" "$cur" ) ) | |
4 | } | |
5 | ||
6 | _lxc_states() { | |
7 | COMPREPLY=( $( compgen -W "STOPPED STARTING RUNNING STOPPING ABORTING FREEZING FROZEN THAWED" "$cur" ) ) | |
8 | } | |
9 | ||
10 | _lxc_templates() { | |
11 | COMPREPLY=( $( compgen -W "$(ls @LXCTEMPLATEDIR@/ | sed -e 's|^lxc-||' )" "$cur" ) ) | |
12 | } | |
13 | ||
e0bc1067 | 14 | _lxc_generic_n() { |
0306de4f SG |
15 | local cur prev |
16 | ||
17 | COMPREPLY=() | |
18 | _get_comp_words_by_ref cur prev | |
19 | ||
20 | case $prev in | |
21 | -n) | |
22 | _lxc_names "$cur" | |
23 | return 0 | |
24 | ;; | |
25 | esac | |
26 | ||
27 | return 1 | |
28 | } | |
29 | ||
e0bc1067 | 30 | _lxc_generic_ns() { |
0306de4f SG |
31 | local cur prev |
32 | ||
33 | COMPREPLY=() | |
34 | _get_comp_words_by_ref cur prev | |
35 | ||
36 | case $prev in | |
37 | -n) | |
38 | _lxc_names "$cur" | |
39 | return 0 | |
40 | ;; | |
41 | ||
42 | -s) | |
43 | _lxc_states "$cur" | |
44 | return 0 | |
45 | ;; | |
46 | esac | |
47 | ||
48 | return 1 | |
49 | } | |
50 | ||
e0bc1067 | 51 | _lxc_generic_t() { |
0306de4f SG |
52 | local cur prev |
53 | ||
54 | COMPREPLY=() | |
55 | _get_comp_words_by_ref cur prev | |
56 | ||
57 | case $prev in | |
58 | -t) | |
59 | _lxc_templates "$cur" | |
60 | return 0 | |
61 | ;; | |
62 | esac | |
63 | ||
64 | return 1 | |
65 | } | |
66 | ||
e0bc1067 | 67 | _lxc_generic_o() { |
0306de4f SG |
68 | local cur prev |
69 | ||
70 | COMPREPLY=() | |
71 | _get_comp_words_by_ref cur prev | |
72 | ||
73 | case $prev in | |
74 | -o) | |
75 | _lxc_names "$cur" | |
76 | return 0 | |
77 | ;; | |
78 | esac | |
79 | ||
80 | return 1 | |
81 | } | |
82 | ||
e0bc1067 LW |
83 | complete -o default -F _lxc_generic_n lxc-attach |
84 | complete -o default -F _lxc_generic_n lxc-cgroup | |
85 | complete -o default -F _lxc_generic_n lxc-console | |
86 | complete -o default -F _lxc_generic_n lxc-destroy | |
87 | complete -o default -F _lxc_generic_n lxc-device | |
88 | complete -o default -F _lxc_generic_n lxc-execute | |
89 | complete -o default -F _lxc_generic_n lxc-freeze | |
90 | complete -o default -F _lxc_generic_n lxc-info | |
91 | complete -o default -F _lxc_generic_n lxc-monitor | |
92 | complete -o default -F _lxc_generic_n lxc-snapshot | |
93 | complete -o default -F _lxc_generic_n lxc-start | |
94 | complete -o default -F _lxc_generic_n lxc-stop | |
95 | complete -o default -F _lxc_generic_n lxc-unfreeze | |
96 | ||
97 | complete -o default -F _lxc_generic_ns lxc-wait | |
98 | ||
99 | complete -o default -F _lxc_generic_t lxc-create | |
100 | ||
d0a6bd39 | 101 | complete -o default -F _lxc_generic_o lxc-copy |
e0bc1067 | 102 | complete -o default -F _lxc_generic_o lxc-start-ephemeral |
0306de4f | 103 | } |