Skip to content

Commit

Permalink
feat(ip): Complete link types for address show
Browse files Browse the repository at this point in the history
  • Loading branch information
yedayak committed Mar 11, 2024
1 parent 8e60245 commit ca5ea03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion completions/ip
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ _comp_cmd_ip()
_comp_compgen_available_interfaces
_comp_compgen -a -- -W 'dev scope to label dynamic
permanent tentative deprecated dadfailed temporary
primary secondary up'
primary secondary up type'
elif [[ $prev == dev ]]; then
_comp_compgen_available_interfaces
elif [[ $prev == scope ]]; then
_comp_cmd_ip__iproute2_etc rt_scopes
elif [[ $prev == type ]]; then
_comp_cmd_ip__link_types "$1"
fi
;;
*)
Expand Down
8 changes: 8 additions & 0 deletions test/t/test_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ def test_monitor(self, completion):
def test_netconf(self, completion):
assert "show" in completion

@pytest.mark.complete(
"ip addr show type ",
require_cmd=True,
skipif="ip link help 2>/dev/null; (( $? != 255 ))",
)
def test_addr_type(self, completion):
assert "bridge" in completion

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

0 comments on commit ca5ea03

Please sign in to comment.