Skip to content

Commit efa663c

Browse files
yedayakscop
authored andcommitted
feat(ip): Complete ip link property
1 parent 7e4cc2f commit efa663c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

completions/ip

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,20 @@ _comp_cmd_ip()
138138
_comp_cmd_ip__iproute2_etc group
139139
fi
140140
;;
141+
property)
142+
if ((cword - 1 == subcword)); then
143+
_comp_compgen -- -W 'add del'
144+
elif [[ $prev == dev ]]; then
145+
_comp_compgen_available_interfaces
146+
elif [[ $prev == altname ]]; then
147+
return
148+
else
149+
_comp_compgen -- -W 'dev altname'
150+
fi
151+
;;
141152
*)
142153
((cword == subcword)) &&
143-
_comp_compgen -- -W 'help add delete set show'
154+
_comp_compgen -- -W 'help add delete set show property'
144155
;;
145156
esac
146157
;;

test/t/test_ip.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ def test_monitor(self, completion):
3636
def test_netconf(self, completion):
3737
assert "show" in completion
3838

39+
@pytest.mark.complete("ip link property add ")
40+
def test_link_property(self, completion):
41+
assert "altname" in completion
42+
assert "dev" in completion
43+
3944
@pytest.mark.complete(
4045
"ip addr show type ",
4146
require_cmd=True,

0 commit comments

Comments
 (0)