Skip to content

Commit

Permalink
feat(ip): Add completion for netconf subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
yedayak authored and scop committed Mar 9, 2024
1 parent df6bcf2 commit 03a10ff
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions completions/ip
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,21 @@ _comp_cmd_ip()
esac
;;

netconf)
case $subcmd in
show)
if ((cword == subcword + 1)); then
_comp_compgen -- -W 'dev'
elif [[ $prev == dev ]]; then
_comp_compgen_available_interfaces
fi
;;
*)
_comp_compgen -- -W 'show'
;;
esac
;;

xfrm)
case $subcmd in
state | policy | monitor)
Expand Down
4 changes: 4 additions & 0 deletions test/t/test_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def test_monitor(self, completion):
assert "neigh" in completion
assert "all" in completion

@pytest.mark.complete("ip netconf ")
def test_netconf(self, completion):
assert "show" in completion

@pytest.mark.complete("ip -", require_cmd=True)
def test_options(self, completion):
assert "-family" in completion

0 comments on commit 03a10ff

Please sign in to comment.