summaryrefslogtreecommitdiffstats
path: root/completions/ipv6calc
diff options
context:
space:
mode:
Diffstat (limited to 'completions/ipv6calc')
-rw-r--r--completions/ipv6calc27
1 files changed, 14 insertions, 13 deletions
diff --git a/completions/ipv6calc b/completions/ipv6calc
index c452c15..7cf7d82 100644
--- a/completions/ipv6calc
+++ b/completions/ipv6calc
@@ -1,23 +1,24 @@
# ipv6calc completion -*- shell-script -*-
-_ipv6calc()
+_comp_cmd_ipv6calc()
{
- local cur prev words cword split
- _init_completion -s || return
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -- "$@" || return
+ local noargopts='!(-*|*[dIOA]*)'
+ # shellcheck disable=SC2254
case "$prev" in
- --debug | -!(-*)d)
+ --debug | -${noargopts}d)
return
;;
- --in | --out | --action | -!(-*)[IOA])
+ --in | --out | --action | -${noargopts}[IOA])
# With ipv6calc < 0.73.0, -m does nothing here, so use sed instead.
- COMPREPLY=($(compgen -W "$($1 "$prev" -h 2>&1 |
- command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p')" \
- -- "$cur"))
+ _comp_compgen_split -- "$("$1" "$prev" -h 2>&1 |
+ command sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p')"
return
;;
--db-geoip | --db-ip2location-ipv4 | --db-ip2location-ipv6)
- _filedir
+ _comp_compgen_filedir
return
;;
--printstart | --printend)
@@ -25,14 +26,14 @@ _ipv6calc()
;;
esac
- $split && return
+ [[ $was_split ]] && return
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$("$1" -h 2>&1 |
- command sed -e "s/[][]//g" | _parse_help -)' -- "$cur"))
+ _comp_compgen_help - <<<"$("$1" -h 2>&1 |
+ command sed -e "s/[][]//g")"
fi
} &&
- complete -F _ipv6calc ipv6calc
+ complete -F _comp_cmd_ipv6calc ipv6calc
# ex: filetype=sh