diff options
Diffstat (limited to 'completions/nmap')
-rw-r--r-- | completions/nmap | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/completions/nmap b/completions/nmap index 482148e..a3e691b 100644 --- a/completions/nmap +++ b/completions/nmap @@ -1,30 +1,30 @@ # bash completion for nmap -*- shell-script -*- -_nmap() +_comp_cmd_nmap() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return case $prev in -iL | -oN | -oX | -oS | -oG | ---excludefile | --resume | --stylesheet) - _filedir + _comp_compgen_filedir return ;; -oA | --datadir) - _filedir -d + _comp_compgen_filedir -d return ;; -e) - _available_interfaces -a + _comp_compgen_available_interfaces -a return ;; -b | --dns-servers) - _known_hosts_real -- "$cur" + _comp_compgen_known_hosts -- "$cur" return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then # strip everything following a :, inclusive @@ -35,7 +35,7 @@ _nmap() # expand --foo/bar to --foo --bar # strip everything following a non-option name or = char # TODO: should expand -T<0-5> to -T0 ... -T5 - COMPREPLY=($(compgen -W "$( + _comp_compgen_split -- "$( "$1" --help 2>&1 | command sed \ -e "s/:.*$//" \ -e "s/=.*$/=/" \ @@ -44,13 +44,12 @@ _nmap() -e "/^[[:space:]]*-[^-]/s/\/\([^-]\)/ -\1/g" \ -e "/^[[:space:]]*--/s/\/\([^-]\)/ --\1/g" \ -e "s/[^[:space:]a-zA-Z0-9=-].*$//" - )" \ - -- "$cur")) + )" [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else - _known_hosts_real -- "$cur" + _comp_compgen_known_hosts -- "$cur" fi } && - complete -F _nmap nmap + complete -F _comp_cmd_nmap nmap # ex: filetype=sh |