completion/nikto: simplify and use `-X '!&*'`

pull/1879/head
John D Pell 2022-01-16 10:41:02 -08:00
parent 3973d422a2
commit 58d21bdf9d
1 changed files with 11 additions and 19 deletions

View File

@ -1,43 +1,35 @@
# shellcheck shell=bash
__nikto_completion() {
local prev=$(_get_pword)
local curr=$(_get_cword)
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD - 1]:-}
case $prev in
-ask)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "yes no auto" -- "$curr"))
COMPREPLY=("yes" "no" "auto")
;;
-Display)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "1 2 3 4 D E P S V" -- "$curr"))
COMPREPLY=('1' '2' '3' '4' 'D' 'E' 'P' 'S' 'V')
;;
-evasion)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "1 2 3 4 5 6 7 8 A B" -- "$curr"))
COMPREPLY=('1' '2' '3' '4' '5' '6' '7' '8' 'A' 'B')
;;
-Format)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "csv htm nbe sql txt xml" -- "$curr"))
COMPREPLY=('csv' 'htm' 'nbe' 'sql' 'txt' 'xml')
;;
-mutate)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "1 2 3 4 5 6" -- "$curr"))
COMPREPLY=('1' '2' '3' '4' '5' '6')
;;
-Tuning)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "0 1 2 3 4 5 6 7 8 9 a b c d e x" -- "$curr"))
COMPREPLY=('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'd' 'e' 'x')
;;
-Userdbs)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "all none" -- "$curr"))
COMPREPLY=('all' 'none')
;;
*)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "-H -Help -ask -Cgidirs -config -Display -dbcheck -evasion -Format -host -404code -404string -id -key -list-plugins -maxtime -mutate -mutate-options -nointeractive -nolookup -nossl -no404 -Option -output -Pause -Plugins -port -RSAcert -root -Save -ssl -Tuning -timeout -Userdbs -useragent -until -update -useproxy -Verbost -vhost" -- "$curr"))
COMPREPLY=('-H' '-Help' '-ask' '-Cgidirs' '-config' '-Display' '-dbcheck' '-evasion' '-Format' '-host' '-404code' '-404string' '-id' '-key' '-list-plugins' '-maxtime' '-mutate' '-mutate-options' '-nointeractive' '-nolookup' '-nossl' '-no404' '-Option' '-output' '-Pause' '-Plugins' '-port' '-RSAcert' '-root' '-Save' '-ssl' '-Tuning' '-timeout' '-Userdbs' '-useragent' '-until' '-update' '-useproxy' '-Verbost' '-vhost')
;;
esac
}
complete -F __nikto_completion nikto
complete -F __nikto_completion -X '!&*' nikto