blob: 9f3e7dd156185f33152d5c69dfd352fb65fd679c (
plain)
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
|
#compdef netcfg netcfg2=netcfg
local -a disp
all_options() {
local _subcommands
_subcommands=('check-iface:Start the specified profile, only if its interface is not currently up'
'down:Stop the specified profile'
'reconnect:Disconnect and reconnect the specified profile'
'iface-down:Stop the profile up on the specified interface'
'all-down:Stop all connected profiles'
'all-suspend:Suspend and store the name of all active profiles'
'all-resume:Reconnect any profiles that have been suspended'
'current:Report currently running profiles'
'list:List all available profiles')
_path_files -W "/etc/network.d" -g "*(.)"
_describe 'subcommand' _subcommands
}
all_profiles() {
_path_files -W "/etc/network.d" -g "*(.)"
}
up_profiles() {
_files -W "/run/network/profiles"
}
up_ifaces() {
_files -W "/run/network/interfaces"
}
_arguments -C \
'(- *)-c[Start specified profile if its interface is not currently up]:Network profile:all_profiles' \
'(- *)-d[Take specified profile down]:Active profiles:up_profiles' \
'(- *)-a[Take all active profiles down]' \
'(- *)-i[Take down profile active on specified interface]:Active interfaces:up_ifaces' \
'(- *)-r[Disconnect and reconnect specified profile]:Active profiles:up_profiles' \
'(- *)-u[Start specified profile]:Network profile:all_profiles' \
'(- *)*:All options:all_options'
if [[ ${#words} == 3 ]]; then
case $words[2] in
'check-iface') all_profiles;;
'reconnect' | 'down') up_profiles;;
'iface-down') up_ifaces;;
esac
fi
|