Skip to content

Commit 03a10ff

Browse files
yedayakscop
authored andcommitted
feat(ip): Add completion for netconf subcommand
1 parent df6bcf2 commit 03a10ff

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

completions/ip

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,21 @@ _comp_cmd_ip()
387387
esac
388388
;;
389389

390+
netconf)
391+
case $subcmd in
392+
show)
393+
if ((cword == subcword + 1)); then
394+
_comp_compgen -- -W 'dev'
395+
elif [[ $prev == dev ]]; then
396+
_comp_compgen_available_interfaces
397+
fi
398+
;;
399+
*)
400+
_comp_compgen -- -W 'show'
401+
;;
402+
esac
403+
;;
404+
390405
xfrm)
391406
case $subcmd in
392407
state | policy | monitor)

test/t/test_ip.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def test_monitor(self, completion):
2323
assert "neigh" in completion
2424
assert "all" in completion
2525

26+
@pytest.mark.complete("ip netconf ")
27+
def test_netconf(self, completion):
28+
assert "show" in completion
29+
2630
@pytest.mark.complete("ip -", require_cmd=True)
2731
def test_options(self, completion):
2832
assert "-family" in completion

0 commit comments

Comments
 (0)