Skip to content

Commit 1f03796

Browse files
committed
feat(ip): Complete commands for netns exec
1 parent efa663c commit 1f03796

File tree

1 file changed

+19
-1
lines changed
  • completions

1 file changed

+19
-1
lines changed

completions/ip

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,27 @@ _comp_cmd_ip()
430430
add | identify | list-id)
431431
# TODO
432432
;;
433-
delete | exec | pids | set)
433+
delete | pids | set)
434434
[[ $prev == "$subcmd" ]] && _comp_cmd_ip__netns "$1"
435435
;;
436+
exec)
437+
local all_offset=0 i
438+
for ((i = 1; i <= cword; i++)); do
439+
case ${words[i]} in
440+
-a | -all)
441+
all_offset=1
442+
break
443+
;;
444+
esac
445+
done
446+
if [[ $prev == "$subcmd" && $all_offset != 1 ]]; then
447+
_comp_cmd_ip__netns "$1"
448+
else
449+
local offset
450+
offset="$((subcword + 2 - all_offset))"
451+
_comp_command_offset "$offset"
452+
fi
453+
;;
436454
*)
437455
((cword == subcword)) &&
438456
_comp_compgen -- -W 'help add delete exec identify list

0 commit comments

Comments
 (0)