forked from treehouses/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_treehouses
157 lines (149 loc) · 4.69 KB
/
_treehouses
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/bash
_treehouses_complete()
{
local cur prev
# Valid top-level completions
commands="ap apchannel bluetooth bluetoothid bootoption bridge burn button camera clone \
container coralenv cron default detect detectrpi discover ethernet expandfs \
feedback help image internet led locale memory networkmode ntp openvpn password \
rebootneeded reboots rename restore rtc services speedtest ssh sshkey sshtunnel \
staticwifi temperature timezone tor upgrade usb version vnc wifi wificountry wifihidden wifistatus"
ap_cmdas="local internet"
apchannel_cmds="1 2 3 4 5 6 7 8 9 10 11"
bluetooth_cmds="on off pause mac id"
bootoption_cmds="console desktop"
bootoption_second_cmds="autologin"
button_cmds="off bluetooth"
camera_cmds="on off capture"
container_cmds="none docker balena"
coralenv_cmds="install demo-on demo-off demo-always-on"
discover_cmds="rpi scan interface ping ports mac"
help_cmds=$commands
led_cmds="green red dance thanksgiving christmas newyear carneval"
memory_cmds="total used free"
networkmode_cmds="info"
ntp_cmds="local internet"
openvpn_cmds="use show delete notice start stop load"
reboots_cmds="now in cron daily weekly monthly"
rtc_cmds="on off"
rtc_on_cmds="ds3231 rasclock"
services_cmds="available installed running ports"
cron_cmds="list 0W tor timestamp add delete deleteall"
sshkey_cmds="add list delete deleteal addgithubusername deletegithubusername addgithubgroup"
ssh_cmds="on off"
sshtunnel_cmds="add remove list key notice"
temperature_cmds="celsius fahrenheit"
tor_cmds="start stop add list notice destroy"
usb_cmds="on off"
notice_cmds="on off add delete list"
remote_cmds="status upgrade"
# upgrade_cmds="" I am not sure whether we should put autocompletion here.
vnc_cmds="on off info"
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]
then
COMPREPLY=( $(compgen -W "${commands}" -- $cur) )
elif [ $COMP_CWORD -eq 2 ]
then
case "$prev" in
"ap")
COMPREPLY=( $(compgen -W "$ap_cmds" -- $cur) )
;;
"apchannel")
COMPREPLY=( $(compgen -W "$apchannel_cmds" -- $cur) ) #cannot ascending order
;;
"bluetooth")
COMPREPLY=( $(compgen -W "$bluetooth_cmds" -- $cur) )
;;
"bootoption")
COMPREPLY=( $(compgen -W "$bootoption_cmds" -- $cur) )
;;
"button")
COMPREPLY=( $(compgen -W "$button_cmds" -- $cur) )
;;
"camera")
COMPREPLY=( $(compgen -W "$camera_cmds" -- $cur) )
;;
"container")
COMPREPLY=( $(compgen -W "$container_cmds" -- $cur) )
;;
"coralenv")
COMPREPLY=( $(compgen -W "$coralenv_cmds" -- $cur) )
;;
"cron")
COMPREPLY=( $(compgen -W "$cron_cmds" -- $cur) )
;;
"discover")
COMPREPLY=( $(compgen -W "$discover_cmds" -- $cur) )
;;
"help")
COMPREPLY=( $(compgen -W "$help_cmds" -- $cur) )
;;
"led")
COMPREPLY=( $(compgen -W "$led_cmds" -- $cur) )
;;
"memory")
COMPREPLY=( $(compgen -W "$memory_cmds" -- $cur) )
;;
"networkmode")
COMPREPLY=( $(compgen -W "$networkmode_cmds" -- $cur) )
;;
"ntp")
COMPREPLY=( $(compgen -W "$ntp_cmds" -- $cur) )
;;
"openvpn")
COMPREPLY=( $(compgen -W "$openvpn_cmds" -- $cur) )
;;
"rtc")
COMPREPLY=( $(compgen -W "$rtc_cmds" -- $cur) )
;;
"reboots")
COMPREPLY=( $(compgen -W "$reboots_cmds" -- $cur) )
;;
"sshkey")
COMPREPLY=( $(compgen -W "$sshkey_cmds" -- $cur) )
;;
"ssh")
COMPREPLY=( $(compgen -W "$ssh_cmds" -- $cur) )
;;
"sshtunnel")
COMPREPLY=( $(compgen -W "$sshtunnel_cmds" -- $cur) )
;;
"temperature")
COMPREPLY=( $(compgen -W "$temperature_cmds" -- $cur) )
;;
"tor")
COMPREPLY=( $(compgen -W "$tor_cmds" -- $cur) )
;;
"usb")
COMPREPLY=( $(compgen -W "$usb_cmds" -- $cur) )
;;
"vnc")
COMPREPLY=( $(compgen -W "$vnc_cmds" -- $cur) )
;;
"wifistatus")
COMPREPLY=( $(compgen -W "$wifistatus_cmds" -- $cur) )
;;
"*")
;;
esac
elif [ $COMP_CWORD -eq 3 ]
then
case "$prev" in
"console")
COMPREPLY=( $(compgen -W "$bootoption_second_cmds" -- $cur) )
;;
"desktop")
COMPREPLY=( $(compgen -W "$bootoption_second_cmds" -- $cur) )
;;
"notice")
COMPREPLY=( $(compgen -W "$notice_cmds" -- $cur) )
;;
"*")
;;
esac
fi
}
complete -F _treehouses_complete treehouses