File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,19 @@ _comp_cmd_ip__link_types()
37
37
) "
38
38
}
39
39
40
+ _comp_cmd_ip__neigh_states ()
41
+ {
42
+ _comp_compgen_split -- " $(
43
+ {
44
+ ${1-ip} -c=never neigh help || ${1-ip} neigh help
45
+ } 2>&1 | command sed -e \
46
+ ' /STATE := /,/}/!d' -e \
47
+ ' s/.*{//' -e \
48
+ ' s/}.*//' -e \
49
+ ' s/|/ /g'
50
+ ) "
51
+ }
52
+
40
53
_comp_cmd_ip ()
41
54
{
42
55
local cur prev words cword comp_args
@@ -344,7 +357,20 @@ _comp_cmd_ip()
344
357
# TODO
345
358
;;
346
359
show | flush)
347
- # TODO
360
+ case " $prev " in
361
+ nud)
362
+ _comp_cmd_ip__neigh_states " $1 "
363
+ ;;
364
+ dev)
365
+ _comp_compgen_available_interfaces
366
+ ;;
367
+ nomaster | proxy | to | vrf) # TODO - Maybe we can complete vrf here?
368
+ :
369
+ ;;
370
+ * )
371
+ _comp_compgen -- -W ' proxy to nud vrf dev nomaster'
372
+ ;;
373
+ esac
348
374
;;
349
375
* )
350
376
(( cword == subcword)) &&
Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ def test_stats(self, completion):
23
23
# "link" was one of the first groups added, should always be there
24
24
assert "link" in completion
25
25
26
+ @pytest .mark .complete (
27
+ "ip neigh show nud " ,
28
+ require_cmd = True ,
29
+ skipif = "ip neigh help 2>&1 | grep 'STATE :=' > /dev/null; (( $? != 0 ))" ,
30
+ )
31
+ def test_neigh_state (self , completion ):
32
+ assert "stale" in completion
33
+
26
34
@pytest .mark .complete (
27
35
"ip monitor " ,
28
36
require_cmd = True ,
You can’t perform that action at this time.
0 commit comments