File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -282,6 +282,41 @@ _comp_cmd_ip()
282
282
;;
283
283
esac
284
284
;;
285
+ stats)
286
+ case " $subcmd " in
287
+ show)
288
+ if [[ $prev == dev ]]; then
289
+ _comp_compgen_available_interfaces
290
+ elif [[ $prev == group ]]; then
291
+ _comp_compgen -- -W " $(
292
+ # stats command was added after color, should always have it
293
+ " $1 " -c=never stats help 2>&1 |
294
+ command sed -e \
295
+ ' /^GROUP := /,/}/!d' -e \
296
+ ' s/^GROUP := //g' -e \
297
+ ' /:=/d' -e \
298
+ ' s/[{}|]//g'
299
+ ) "
300
+ elif [[ $prev == subgroup || $prev == suite ]]; then
301
+ : # TODO: complete subgroup and suite
302
+ else
303
+ _comp_compgen -- -W ' dev group subgroup suite'
304
+ fi
305
+ ;;
306
+ set)
307
+ if [[ $prev == dev ]]; then
308
+ _comp_compgen_available_interfaces
309
+ elif [[ $prev == l3_stats ]]; then
310
+ _comp_compgen -- -W ' on off'
311
+ else
312
+ _comp_compgen -- -W ' dev l3_stats'
313
+ fi
314
+ ;;
315
+ * )
316
+ _comp_compgen -- -W ' show set help'
317
+ ;;
318
+ esac
319
+ ;;
285
320
286
321
n | neigh | neighbor | neighbour)
287
322
case $subcmd in
Original file line number Diff line number Diff line change @@ -14,6 +14,15 @@ def test_2(self, completion):
14
14
def test_r_r (self , completion ):
15
15
assert completion
16
16
17
+ @pytest .mark .complete (
18
+ "ip stats show group " ,
19
+ require_cmd = True ,
20
+ skipif = "ip stats help 2>/dev/null; (( $? != 255 ))" ,
21
+ )
22
+ def test_stats (self , completion ):
23
+ # "link" was one of the first groups added, should always be there
24
+ assert "link" in completion
25
+
17
26
@pytest .mark .complete (
18
27
"ip monitor " ,
19
28
require_cmd = True ,
You can’t perform that action at this time.
0 commit comments