blob: 05c506f7bd7d3dfc19ad53866e4e973466657bda (
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
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
|
#compdef netctl netctl-auto wifi-menu
(( $+function[_wireless_interfaces] )) ||
_wireless_interfaces() {
local interfaces
interfaces=(/sys/class/net/*/wireless(/))
print -l ${${(R)interfaces%/wireless}:t}
}
(( $+function[_netctl_command] )) ||
_netctl_command() {
[[ $words[1] = (start|stop|restart|switch-to|status|enable|disable|reenable|is-enabled|edit) ]] &&
compadd "${(f)$(find -L /etc/netctl -maxdepth 1 -type f -not -name '.*' -not -name '*~' -not -name '*.conf' -not -name '*.service' -printf "%f\n")}"
}
_netctl_commands() {
local -a _commands
_commands=(
'list:List available profiles'
'store:Save which profiles are active'
'restore:Load saved profiles'
'stop-all:Stops all profiles'
'start:Start a profile'
'stop:Stop a profile'
'restart:Restart a profile'
'switch-to:Switch to a profile'
'status:Show runtime status of a profile'
'enable:Enable the systemd unit for a profile'
'disable:Disable the systemd unit for a profile'
'reenable:Reenable the systemd unit for a profile'
'is-enabled:Check whether a profile is enabled'
'edit:Edit a profile'
)
_describe "netctl commands" _commands
}
_netctl-auto_commands() {
local -a _commands
_commands=(
'list:List available profiles'
'current:List currently active profiles'
'switch-to:Switch to a profile, enable it if necessary'
'enable:Enable a profile for automatic selection'
'disable:Disable a profile temporarily for automatic selection'
'enable-all:Enable all profiles for automatic selection'
'disable-all:Disable all profiles temporarily for automatic selection'
)
_describe "netctl-auto commands" _commands
}
case $service in
netctl|netctl-auto)
case $CURRENT in
2)
_arguments \
'(- :)--version[display version information]' \
'(- :)--help[display help message]' \
'(-)::netctl commands:_${service}_commands'
;;
3)
shift words
[[ $words[1] != -* ]] &&
curcontext="${curcontext%:*}-${words[1]}:" _netctl_command
;;
esac
;;
wifi-menu)
(( CURRENT == 2 )) && compadd "${(f)$(_wireless_interfaces)}"
;;
esac
|