Skip to content

Commit

Permalink
feat(ip): Complete commands for netns exec
Browse files Browse the repository at this point in the history
  • Loading branch information
yedayak committed Apr 2, 2024
1 parent efa663c commit 1f03796
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion completions/ip
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,27 @@ _comp_cmd_ip()
add | identify | list-id)
# TODO
;;
delete | exec | pids | set)
delete | pids | set)
[[ $prev == "$subcmd" ]] && _comp_cmd_ip__netns "$1"
;;
exec)
local all_offset=0 i
for ((i = 1; i <= cword; i++)); do
case ${words[i]} in
-a | -all)
all_offset=1
break
;;
esac
done
if [[ $prev == "$subcmd" && $all_offset != 1 ]]; then
_comp_cmd_ip__netns "$1"
else
local offset
offset="$((subcword + 2 - all_offset))"
_comp_command_offset "$offset"
fi
;;
*)
((cword == subcword)) &&
_comp_compgen -- -W 'help add delete exec identify list
Expand Down

0 comments on commit 1f03796

Please sign in to comment.