11# bash completion for bluez utils -*- shell-script -*-
22
3- _bluetooth_addresses ()
3+ _comp_cmd_hcitool__bluetooth_addresses ()
44{
55 if [[ ${COMP_BLUETOOTH_SCAN-} ]]; then
66 COMPREPLY+=($( compgen -W " $( hcitool scan |
77 awk ' /^\t/{print $1}' ) " -- " $cur " ) )
88 fi
99}
1010
11- _bluetooth_devices ()
11+ _comp_cmd_hcitool__bluetooth_devices ()
1212{
1313 COMPREPLY+=($( compgen -W " $( hcitool dev |
1414 awk ' /^\t/{print $1}' ) " -- " $cur " ) )
1515}
1616
17- _bluetooth_services ()
17+ _comp_cmd_hcitool__bluetooth_services ()
1818{
1919 COMPREPLY=($( compgen -W ' DID SP DUN LAN FAX OPUSH FTP HS HF HFAG SAP NAP
2020 GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE UDITE SYNCML' \
2121 -- " $cur " ) )
2222}
2323
24- _bluetooth_packet_types ()
24+ _comp_cmd_hcitool__bluetooth_packet_types ()
2525{
2626 COMPREPLY=($( compgen -W ' DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \
2727 -- " $cur " ) )
2828}
2929
30- _hcitool ()
30+ _comp_cmd_hcitool ()
3131{
3232 local cur prev words cword split comp_args
3333 _comp_initialize -s -- " $@ " || return
3434
3535 case $prev in
3636 -i)
37- _bluetooth_devices
37+ _comp_cmd_hcitool__bluetooth_devices
3838 return
3939 ;;
4040 --role)
4141 COMPREPLY=($( compgen -W ' m s' -- " $cur " ) )
4242 return
4343 ;;
4444 --pkt-type)
45- _bluetooth_packet_types
45+ _comp_cmd_hcitool__bluetooth_packet_types
4646 return
4747 ;;
4848 esac
@@ -65,7 +65,7 @@ _hcitool()
6565 name | info | dc | rssi | lq | afh | auth | key | clkoff | lst)
6666 _count_args
6767 if (( args == 2 )) ; then
68- _bluetooth_addresses
68+ _comp_cmd_hcitool__bluetooth_addresses
6969 fi
7070 ;;
7171 cc)
@@ -74,47 +74,47 @@ _hcitool()
7474 else
7575 _count_args
7676 if (( args == 2 )) ; then
77- _bluetooth_addresses
77+ _comp_cmd_hcitool__bluetooth_addresses
7878 fi
7979 fi
8080 ;;
8181 sr)
8282 _count_args
8383 if (( args == 2 )) ; then
84- _bluetooth_addresses
84+ _comp_cmd_hcitool__bluetooth_addresses
8585 else
8686 COMPREPLY=($( compgen -W ' master slave' -- " $cur " ) )
8787 fi
8888 ;;
8989 cpt)
9090 _count_args
9191 if (( args == 2 )) ; then
92- _bluetooth_addresses
92+ _comp_cmd_hcitool__bluetooth_addresses
9393 else
94- _bluetooth_packet_types
94+ _comp_cmd_hcitool__bluetooth_packet_types
9595 fi
9696 ;;
9797 tpl | enc | clock)
9898 _count_args
9999 if (( args == 2 )) ; then
100- _bluetooth_addresses
100+ _comp_cmd_hcitool__bluetooth_addresses
101101 else
102102 COMPREPLY=($( compgen -W ' 0 1' -- " $cur " ) )
103103 fi
104104 ;;
105105 esac
106106 fi
107107} &&
108- complete -F _hcitool hcitool
108+ complete -F _comp_cmd_hcitool hcitool
109109
110- _sdptool ()
110+ _comp_cmd_sdptool ()
111111{
112112 local cur prev words cword split comp_args
113113 _comp_initialize -s -- " $@ " || return
114114
115115 case $prev in
116116 --bdaddr)
117- _bluetooth_addresses
117+ _comp_cmd_hcitool__bluetooth_addresses
118118 return
119119 ;;
120120 esac
@@ -137,21 +137,21 @@ _sdptool()
137137 COMPREPLY=($( compgen -W ' --bdaddr --tree --raw --xml' \
138138 -- " $cur " ) )
139139 else
140- _bluetooth_services
140+ _comp_cmd_hcitool__bluetooth_services
141141 fi
142142 ;;
143143 browse | records)
144144 if [[ $cur == -* ]]; then
145145 COMPREPLY=($( compgen -W ' --tree --raw --xml' -- " $cur " ) )
146146 else
147- _bluetooth_addresses
147+ _comp_cmd_hcitool__bluetooth_addresses
148148 fi
149149 ;;
150150 add)
151151 if [[ $cur == -* ]]; then
152152 COMPREPLY=($( compgen -W ' --handle --channel' -- " $cur " ) )
153153 else
154- _bluetooth_services
154+ _comp_cmd_hcitool__bluetooth_services
155155 fi
156156 ;;
157157 get)
@@ -163,16 +163,16 @@ _sdptool()
163163 esac
164164 fi
165165} &&
166- complete -F _sdptool sdptool
166+ complete -F _comp_cmd_sdptool sdptool
167167
168- _l2ping ()
168+ _comp_cmd_l2ping ()
169169{
170170 local cur prev words cword comp_args
171171 _comp_initialize -- " $@ " || return
172172
173173 case $prev in
174174 -i)
175- _bluetooth_devices
175+ _comp_cmd_hcitool__bluetooth_devices
176176 return
177177 ;;
178178 -s | -c | -t | -d)
@@ -183,12 +183,12 @@ _l2ping()
183183 if [[ $cur == -* ]]; then
184184 COMPREPLY=($( compgen -W ' $(_parse_usage "$1")' -- " $cur " ) )
185185 else
186- _bluetooth_addresses
186+ _comp_cmd_hcitool__bluetooth_addresses
187187 fi
188188} &&
189- complete -F _l2ping l2ping
189+ complete -F _comp_cmd_l2ping l2ping
190190
191- _rfcomm ()
191+ _comp_cmd_rfcomm ()
192192{
193193 local cur prev words cword comp_args
194194 _comp_initialize -- " $@ " || return
@@ -199,8 +199,8 @@ _rfcomm()
199199 return
200200 ;;
201201 -i)
202- _bluetooth_devices
203- _bluetooth_addresses
202+ _comp_cmd_hcitool__bluetooth_devices
203+ _comp_cmd_hcitool__bluetooth_addresses
204204 return
205205 ;;
206206 esac
@@ -218,29 +218,29 @@ _rfcomm()
218218 local args
219219 _count_args
220220 if (( args == 2 )) ; then
221- _bluetooth_devices
221+ _comp_cmd_hcitool__bluetooth_devices
222222 else
223223 case $arg in
224224 connect | bind)
225225 if (( args == 3 )) ; then
226- _bluetooth_addresses
226+ _comp_cmd_hcitool__bluetooth_addresses
227227 fi
228228 ;;
229229 esac
230230 fi
231231 fi
232232} &&
233- complete -F _rfcomm rfcomm
233+ complete -F _comp_cmd_rfcomm rfcomm
234234
235- _ciptool ()
235+ _comp_cmd_ciptool ()
236236{
237237 local cur prev words cword comp_args
238238 _comp_initialize -- " $@ " || return
239239
240240 case $prev in
241241 -i)
242- _bluetooth_devices
243- _bluetooth_addresses
242+ _comp_cmd_hcitool__bluetooth_devices
243+ _comp_cmd_hcitool__bluetooth_addresses
244244 return
245245 ;;
246246 esac
@@ -260,22 +260,22 @@ _ciptool()
260260 connect | release | loopback)
261261 _count_args
262262 if (( args == 2 )) ; then
263- _bluetooth_addresses
263+ _comp_cmd_hcitool__bluetooth_addresses
264264 fi
265265 ;;
266266 esac
267267 fi
268268} &&
269- complete -F _ciptool ciptool
269+ complete -F _comp_cmd_ciptool ciptool
270270
271- _dfutool ()
271+ _comp_cmd_dfutool ()
272272{
273273 local cur prev words cword comp_args
274274 _comp_initialize -- " $@ " || return
275275
276276 case $prev in
277277 -d | --device)
278- _bluetooth_devices
278+ _comp_cmd_hcitool__bluetooth_devices
279279 return
280280 ;;
281281 esac
@@ -296,9 +296,9 @@ _dfutool()
296296 esac
297297 fi
298298} &&
299- complete -F _dfutool dfutool
299+ complete -F _comp_cmd_dfutool dfutool
300300
301- _hciconfig ()
301+ _comp_cmd_hciconfig ()
302302{
303303 local cur prev words cword comp_args
304304 _comp_initialize -- " $@ " || return
@@ -321,7 +321,7 @@ _hciconfig()
321321 putkey | delkey)
322322 _count_args
323323 if (( args == 2 )) ; then
324- _bluetooth_addresses
324+ _comp_cmd_hcitool__bluetooth_addresses
325325 fi
326326 ;;
327327 lm)
@@ -334,15 +334,15 @@ _hciconfig()
334334 ptype)
335335 _count_args
336336 if (( args == 2 )) ; then
337- _bluetooth_packet_types
337+ _comp_cmd_hcitool__bluetooth_packet_types
338338 fi
339339 ;;
340340 esac
341341 fi
342342} &&
343- complete -F _hciconfig hciconfig
343+ complete -F _comp_cmd_hciconfig hciconfig
344344
345- _hciattach ()
345+ _comp_cmd_hciattach ()
346346{
347347 local cur prev words cword comp_args
348348 _comp_initialize -- " $@ " || return
@@ -371,11 +371,11 @@ _hciattach()
371371 COMPREPLY=($( compgen -W ' flow noflow' -- " $cur " ) )
372372 ;;
373373 5)
374- _bluetooth_addresses
374+ _comp_cmd_hcitool__bluetooth_addresses
375375 ;;
376376 esac
377377 fi
378378} &&
379- complete -F _hciattach hciattach
379+ complete -F _comp_cmd_hciattach hciattach
380380
381381# ex: filetype=sh
0 commit comments