1
1
# bash completion for bluez utils -*- shell-script -*-
2
2
3
- _bluetooth_addresses ()
3
+ _comp_cmd_hcitool__bluetooth_addresses ()
4
4
{
5
5
if [[ ${COMP_BLUETOOTH_SCAN-} ]]; then
6
6
COMPREPLY+=($( compgen -W " $( hcitool scan |
7
7
awk ' /^\t/{print $1}' ) " -- " $cur " ) )
8
8
fi
9
9
}
10
10
11
- _bluetooth_devices ()
11
+ _comp_cmd_hcitool__bluetooth_devices ()
12
12
{
13
13
COMPREPLY+=($( compgen -W " $( hcitool dev |
14
14
awk ' /^\t/{print $1}' ) " -- " $cur " ) )
15
15
}
16
16
17
- _bluetooth_services ()
17
+ _comp_cmd_hcitool__bluetooth_services ()
18
18
{
19
19
COMPREPLY=($( compgen -W ' DID SP DUN LAN FAX OPUSH FTP HS HF HFAG SAP NAP
20
20
GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE UDITE SYNCML' \
21
21
-- " $cur " ) )
22
22
}
23
23
24
- _bluetooth_packet_types ()
24
+ _comp_cmd_hcitool__bluetooth_packet_types ()
25
25
{
26
26
COMPREPLY=($( compgen -W ' DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \
27
27
-- " $cur " ) )
28
28
}
29
29
30
- _hcitool ()
30
+ _comp_cmd_hcitool ()
31
31
{
32
32
local cur prev words cword split comp_args
33
33
_comp_initialize -s -- " $@ " || return
34
34
35
35
case $prev in
36
36
-i)
37
- _bluetooth_devices
37
+ _comp_cmd_hcitool__bluetooth_devices
38
38
return
39
39
;;
40
40
--role)
41
41
COMPREPLY=($( compgen -W ' m s' -- " $cur " ) )
42
42
return
43
43
;;
44
44
--pkt-type)
45
- _bluetooth_packet_types
45
+ _comp_cmd_hcitool__bluetooth_packet_types
46
46
return
47
47
;;
48
48
esac
@@ -65,7 +65,7 @@ _hcitool()
65
65
name | info | dc | rssi | lq | afh | auth | key | clkoff | lst)
66
66
_count_args
67
67
if (( args == 2 )) ; then
68
- _bluetooth_addresses
68
+ _comp_cmd_hcitool__bluetooth_addresses
69
69
fi
70
70
;;
71
71
cc)
@@ -74,47 +74,47 @@ _hcitool()
74
74
else
75
75
_count_args
76
76
if (( args == 2 )) ; then
77
- _bluetooth_addresses
77
+ _comp_cmd_hcitool__bluetooth_addresses
78
78
fi
79
79
fi
80
80
;;
81
81
sr)
82
82
_count_args
83
83
if (( args == 2 )) ; then
84
- _bluetooth_addresses
84
+ _comp_cmd_hcitool__bluetooth_addresses
85
85
else
86
86
COMPREPLY=($( compgen -W ' master slave' -- " $cur " ) )
87
87
fi
88
88
;;
89
89
cpt)
90
90
_count_args
91
91
if (( args == 2 )) ; then
92
- _bluetooth_addresses
92
+ _comp_cmd_hcitool__bluetooth_addresses
93
93
else
94
- _bluetooth_packet_types
94
+ _comp_cmd_hcitool__bluetooth_packet_types
95
95
fi
96
96
;;
97
97
tpl | enc | clock)
98
98
_count_args
99
99
if (( args == 2 )) ; then
100
- _bluetooth_addresses
100
+ _comp_cmd_hcitool__bluetooth_addresses
101
101
else
102
102
COMPREPLY=($( compgen -W ' 0 1' -- " $cur " ) )
103
103
fi
104
104
;;
105
105
esac
106
106
fi
107
107
} &&
108
- complete -F _hcitool hcitool
108
+ complete -F _comp_cmd_hcitool hcitool
109
109
110
- _sdptool ()
110
+ _comp_cmd_sdptool ()
111
111
{
112
112
local cur prev words cword split comp_args
113
113
_comp_initialize -s -- " $@ " || return
114
114
115
115
case $prev in
116
116
--bdaddr)
117
- _bluetooth_addresses
117
+ _comp_cmd_hcitool__bluetooth_addresses
118
118
return
119
119
;;
120
120
esac
@@ -137,21 +137,21 @@ _sdptool()
137
137
COMPREPLY=($( compgen -W ' --bdaddr --tree --raw --xml' \
138
138
-- " $cur " ) )
139
139
else
140
- _bluetooth_services
140
+ _comp_cmd_hcitool__bluetooth_services
141
141
fi
142
142
;;
143
143
browse | records)
144
144
if [[ $cur == -* ]]; then
145
145
COMPREPLY=($( compgen -W ' --tree --raw --xml' -- " $cur " ) )
146
146
else
147
- _bluetooth_addresses
147
+ _comp_cmd_hcitool__bluetooth_addresses
148
148
fi
149
149
;;
150
150
add)
151
151
if [[ $cur == -* ]]; then
152
152
COMPREPLY=($( compgen -W ' --handle --channel' -- " $cur " ) )
153
153
else
154
- _bluetooth_services
154
+ _comp_cmd_hcitool__bluetooth_services
155
155
fi
156
156
;;
157
157
get)
@@ -163,16 +163,16 @@ _sdptool()
163
163
esac
164
164
fi
165
165
} &&
166
- complete -F _sdptool sdptool
166
+ complete -F _comp_cmd_sdptool sdptool
167
167
168
- _l2ping ()
168
+ _comp_cmd_l2ping ()
169
169
{
170
170
local cur prev words cword comp_args
171
171
_comp_initialize -- " $@ " || return
172
172
173
173
case $prev in
174
174
-i)
175
- _bluetooth_devices
175
+ _comp_cmd_hcitool__bluetooth_devices
176
176
return
177
177
;;
178
178
-s | -c | -t | -d)
@@ -183,12 +183,12 @@ _l2ping()
183
183
if [[ $cur == -* ]]; then
184
184
COMPREPLY=($( compgen -W ' $(_parse_usage "$1")' -- " $cur " ) )
185
185
else
186
- _bluetooth_addresses
186
+ _comp_cmd_hcitool__bluetooth_addresses
187
187
fi
188
188
} &&
189
- complete -F _l2ping l2ping
189
+ complete -F _comp_cmd_l2ping l2ping
190
190
191
- _rfcomm ()
191
+ _comp_cmd_rfcomm ()
192
192
{
193
193
local cur prev words cword comp_args
194
194
_comp_initialize -- " $@ " || return
@@ -199,8 +199,8 @@ _rfcomm()
199
199
return
200
200
;;
201
201
-i)
202
- _bluetooth_devices
203
- _bluetooth_addresses
202
+ _comp_cmd_hcitool__bluetooth_devices
203
+ _comp_cmd_hcitool__bluetooth_addresses
204
204
return
205
205
;;
206
206
esac
@@ -218,29 +218,29 @@ _rfcomm()
218
218
local args
219
219
_count_args
220
220
if (( args == 2 )) ; then
221
- _bluetooth_devices
221
+ _comp_cmd_hcitool__bluetooth_devices
222
222
else
223
223
case $arg in
224
224
connect | bind)
225
225
if (( args == 3 )) ; then
226
- _bluetooth_addresses
226
+ _comp_cmd_hcitool__bluetooth_addresses
227
227
fi
228
228
;;
229
229
esac
230
230
fi
231
231
fi
232
232
} &&
233
- complete -F _rfcomm rfcomm
233
+ complete -F _comp_cmd_rfcomm rfcomm
234
234
235
- _ciptool ()
235
+ _comp_cmd_ciptool ()
236
236
{
237
237
local cur prev words cword comp_args
238
238
_comp_initialize -- " $@ " || return
239
239
240
240
case $prev in
241
241
-i)
242
- _bluetooth_devices
243
- _bluetooth_addresses
242
+ _comp_cmd_hcitool__bluetooth_devices
243
+ _comp_cmd_hcitool__bluetooth_addresses
244
244
return
245
245
;;
246
246
esac
@@ -260,22 +260,22 @@ _ciptool()
260
260
connect | release | loopback)
261
261
_count_args
262
262
if (( args == 2 )) ; then
263
- _bluetooth_addresses
263
+ _comp_cmd_hcitool__bluetooth_addresses
264
264
fi
265
265
;;
266
266
esac
267
267
fi
268
268
} &&
269
- complete -F _ciptool ciptool
269
+ complete -F _comp_cmd_ciptool ciptool
270
270
271
- _dfutool ()
271
+ _comp_cmd_dfutool ()
272
272
{
273
273
local cur prev words cword comp_args
274
274
_comp_initialize -- " $@ " || return
275
275
276
276
case $prev in
277
277
-d | --device)
278
- _bluetooth_devices
278
+ _comp_cmd_hcitool__bluetooth_devices
279
279
return
280
280
;;
281
281
esac
@@ -296,9 +296,9 @@ _dfutool()
296
296
esac
297
297
fi
298
298
} &&
299
- complete -F _dfutool dfutool
299
+ complete -F _comp_cmd_dfutool dfutool
300
300
301
- _hciconfig ()
301
+ _comp_cmd_hciconfig ()
302
302
{
303
303
local cur prev words cword comp_args
304
304
_comp_initialize -- " $@ " || return
@@ -321,7 +321,7 @@ _hciconfig()
321
321
putkey | delkey)
322
322
_count_args
323
323
if (( args == 2 )) ; then
324
- _bluetooth_addresses
324
+ _comp_cmd_hcitool__bluetooth_addresses
325
325
fi
326
326
;;
327
327
lm)
@@ -334,15 +334,15 @@ _hciconfig()
334
334
ptype)
335
335
_count_args
336
336
if (( args == 2 )) ; then
337
- _bluetooth_packet_types
337
+ _comp_cmd_hcitool__bluetooth_packet_types
338
338
fi
339
339
;;
340
340
esac
341
341
fi
342
342
} &&
343
- complete -F _hciconfig hciconfig
343
+ complete -F _comp_cmd_hciconfig hciconfig
344
344
345
- _hciattach ()
345
+ _comp_cmd_hciattach ()
346
346
{
347
347
local cur prev words cword comp_args
348
348
_comp_initialize -- " $@ " || return
@@ -371,11 +371,11 @@ _hciattach()
371
371
COMPREPLY=($( compgen -W ' flow noflow' -- " $cur " ) )
372
372
;;
373
373
5)
374
- _bluetooth_addresses
374
+ _comp_cmd_hcitool__bluetooth_addresses
375
375
;;
376
376
esac
377
377
fi
378
378
} &&
379
- complete -F _hciattach hciattach
379
+ complete -F _comp_cmd_hciattach hciattach
380
380
381
381
# ex: filetype=sh
0 commit comments