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()
82
82
[[ ${words[subcword]} == -b ? (atch) ]] && return
83
83
[[ $has_cmd ]] && subcmd=${words[subcword]} && break
84
84
[[ ${words[subcword]} != -* &&
85
- ${words[subcword - 1]} != -@ (f? (amily)| rc? (vbuf)) ]] &&
85
+ ${words[subcword - 1]} != -@ (f? (amily)| rc? (vbuf)| n ? (etns) ) ]] &&
86
86
cmd=${words[subcword]} has_cmd=set
87
87
done
88
88
@@ -465,12 +465,30 @@ _comp_cmd_ip()
465
465
add | identify | list-id)
466
466
# TODO
467
467
;;
468
- delete | exec | pids | set)
468
+ delete | pids | set)
469
469
[[ $prev == " $subcmd " ]] && _comp_cmd_ip__netns " $1 "
470
470
;;
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
+ ;;
471
489
* )
472
490
(( cword == subcword)) &&
473
- _comp_compgen -- -W ' help add delete exec identify list
491
+ _comp_compgen -- -W ' help add attach delete exec identify list
474
492
list-id monitor pids set'
475
493
;;
476
494
esac
You can’t perform that action at this time.
0 commit comments