File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ _comp_cmd_ip()
8282 [[ ${words[subcword]} == -b ? (atch) ]] && return
8383 [[ $has_cmd ]] && subcmd=${words[subcword]} && break
8484 [[ ${words[subcword]} != -* &&
85- ${words[subcword - 1]} != -@ (f? (amily)| rc? (vbuf)) ]] &&
85+ ${words[subcword - 1]} != -@ (f? (amily)| rc? (vbuf)| n ? (etns) ) ]] &&
8686 cmd=${words[subcword]} has_cmd=set
8787 done
8888
@@ -465,12 +465,30 @@ _comp_cmd_ip()
465465 add | identify | list-id)
466466 # TODO
467467 ;;
468- delete | exec | pids | set)
468+ delete | pids | set)
469469 [[ $prev == " $subcmd " ]] && _comp_cmd_ip__netns " $1 "
470470 ;;
471+ exec)
472+ local all_offset=0 i
473+ for (( i = 1 ; i <= cword; i++ )) ; do
474+ case ${words[i]} in
475+ -a | -all)
476+ all_offset=1
477+ break
478+ ;;
479+ esac
480+ done
481+ if [[ $prev == " $subcmd " && $all_offset != 1 ]]; then
482+ _comp_cmd_ip__netns " $1 "
483+ else
484+ local offset
485+ offset=" $(( subcword + 2 - all_offset)) "
486+ _comp_command_offset " $offset "
487+ fi
488+ ;;
471489 * )
472490 (( cword == subcword)) &&
473- _comp_compgen -- -W ' help add delete exec identify list
491+ _comp_compgen -- -W ' help add attach delete exec identify list
474492 list-id monitor pids set'
475493 ;;
476494 esac
You can’t perform that action at this time.
0 commit comments