Skip to content

Commit

Permalink
ip: add more completions for ip-rule
Browse files Browse the repository at this point in the history
  • Loading branch information
felixonmars authored and scop committed May 24, 2020
1 parent ac37d77 commit 426d07e
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions completions/ip
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,39 @@ _ip()

rule)
case $subcmd in
add | del)
# TODO
add|del|list|lst)
case $prev in
from|to|tos|dsfield|fwmark|uidrange|ipproto|sport| \
dport|priority|protocol|suppress_prefixlength| \
suppress_ifgroup|realms|nat|goto)
;;
iif|oif)
_available_interfaces -a
;;
table|lookup)
COMPREPLY=( $(compgen -W 'local main default' -- "$cur") )
;;
*)
COMPREPLY=( $(compgen -W 'from to tos dsfield fwmark
uidrange ipproto sport dport priority table lookup
protocol suppress_prefixlength suppress_ifgroup realms
nat goto iif oif not' -- "$cur") )
;;
esac
;;
flush|save)
if [[ $prev == protocol ]]; then
:
else
COMPREPLY=( $(compgen -W 'protocol' -- "$cur") )
fi
;;
restore|show)
;;
flush | show | list | lst) ;;

*)
((cword == subcword)) &&
COMPREPLY=($(compgen -W 'help list add del flush' \
-- "$cur"))
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $(compgen -W 'help add del list flush save
restore show' -- "$cur") )
;;
esac
;;
Expand Down

0 comments on commit 426d07e

Please sign in to comment.