Skip to content

Commit f3a9be3

Browse files
committed
fix(ip): Complete ip delete with type correctly
The completion until now didn't complete "type" until you wrote it yourself, and than completed "type" again. Fix that, and also use _comp_cmd_ip__link_types to complete all types and not just some of them.
1 parent ca5ea03 commit f3a9be3

File tree

1 file changed

+6
-13
lines changed
  • completions

1 file changed

+6
-13
lines changed

completions/ip

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,12 @@ _comp_cmd_ip()
100100
# TODO
101101
;;
102102
delete)
103-
case $((cword - subcword)) in
104-
1)
105-
_comp_compgen_available_interfaces
106-
;;
107-
2)
108-
_comp_compgen -- -W 'type'
109-
;;
110-
3)
111-
[[ $prev == type ]] &&
112-
_comp_compgen -- -W 'vlan veth vcan dummy ifb
113-
macvlan can'
114-
;;
115-
esac
103+
if [[ $prev == type ]]; then
104+
_comp_cmd_ip__link_types "$1"
105+
else
106+
_comp_compgen_available_interfaces
107+
_comp_compgen -a -- -W 'type'
108+
fi
116109
;;
117110
set)
118111
if ((cword - subcword == 1)); then

0 commit comments

Comments
 (0)