diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
commit | 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch) | |
tree | 0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/ebtables | |
parent | Releasing progress-linux version 1:2.11-8~progress7.99u1. (diff) | |
download | bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/ebtables')
-rw-r--r-- | completions/ebtables | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/completions/ebtables b/completions/ebtables index de6bc54..24f3fe7 100644 --- a/completions/ebtables +++ b/completions/ebtables @@ -1,47 +1,49 @@ # bash completion for ebtables -*- shell-script -*- -_ebtables() +_comp_cmd_ebtables() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return - local table chain='s/^Bridge chain: \([^ ,]\{1,\}\).*$/\1/p' \ + local table="" chain='s/^Bridge chain: \([^ ,]\{1,\}\).*$/\1/p' \ targets='ACCEPT DROP CONTINUE RETURN' + local IFS=$' \t\n' # for ${table:+-t "$table"} [[ ${words[*]} =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] && - table="-t ${BASH_REMATCH[2]}" + table=${BASH_REMATCH[2]} + local noargopts='!(-*|*[AIDPFXLZtj]*)' + # shellcheck disable=SC2254 case $prev in - -!(-*)[AIDPFXLZ]) - COMPREPLY=($(compgen -W '`"$1" $table -L 2>/dev/null | \ - command sed -ne "$chain"`' -- "$cur")) + -${noargopts}[AIDPFXLZ]) + _comp_compgen_split -- "$( + "$1" ${table:+-t "$table"} -L 2>/dev/null | + command sed -ne "$chain" + )" ;; - -!(-*)t) - COMPREPLY=($(compgen -W 'nat filter broute' -- "$cur")) + -${noargopts}t) + _comp_compgen -- -W 'nat filter broute' ;; - -!(-*)j) - if [[ $table == "-t filter" || -z $table ]]; then - COMPREPLY=($(compgen -W '$targets - $("$1" $table -L 2>/dev/null | \ - command sed -n -e "s/INPUT\|OUTPUT\|FORWARD//" \ - -e "$chain")' \ - -- "$cur")) - elif [[ $table == "-t nat" ]]; then - COMPREPLY=($(compgen -W '$targets - $("$1" $table -L 2>/dev/null | \ - command sed -n -e "s/OUTPUT|PREROUTING|POSTROUTING//" \ - -e "$chain")' \ - -- "$cur")) - elif [[ $table == "-t broute" ]]; then - COMPREPLY=($(compgen -W 'ACCEPT DROP - $("$1" $table -L 2>/dev/null | \ - command sed -n -e "s/BROUTING//" -e "$chain")' \ - -- "$cur")) + -${noargopts}j) + if [[ $table == "filter" || ! $table ]]; then + _comp_compgen -- -W '$targets' + _comp_compgen -a split -- "$("$1" ${table:+-t "$table"} -L \ + 2>/dev/null | command sed -n -e \ + "s/INPUT\|OUTPUT\|FORWARD//" -e "$chain")" + elif [[ $table == "nat" ]]; then + _comp_compgen -- -W '$targets' + _comp_compgen -a split -- "$("$1" -t "$table" -L 2>/dev/null | + command sed -n -e "s/OUTPUT|PREROUTING|POSTROUTING//" \ + -e "$chain")" + elif [[ $table == "broute" ]]; then + _comp_compgen -- -W 'ACCEPT DROP' + _comp_compgen -a split -- "$("$1" -t "$table" -L 2>/dev/null | + command sed -n -e "s/BROUTING//" -e "$chain")" fi ;; *) if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '--802_3-sap --802_3-type --among-dst + _comp_compgen -- -W '--802_3-sap --802_3-type --among-dst --among-dst-file --among-src --among-src-file --append --arp-gratuitous --arp-htype --arp-ip-dst --arp-ip-src --arp-mac-dst --arp-mac-src --arp-opcode --arp-ptype --arpreply-mac @@ -67,12 +69,12 @@ _ebtables() --stp-sender-prio --stp-type --table --to-destination --to-dst --to-source --to-src --ulog --ulog-cprange --ulog-nlgroup --ulog-prefix --ulog-qthreshold --version --vlan-encap --vlan-id - --vlan-prio --zero' -- "$cur")) + --vlan-prio --zero' fi ;; esac } && - complete -F _ebtables ebtables + complete -F _comp_cmd_ebtables ebtables # ex: filetype=sh |