final fix to completion done

pull/1770/head
Gurkirat Singh 2021-01-24 17:50:16 +05:30
parent cc3656e557
commit f0a5bdf023
No known key found for this signature in database
GPG Key ID: CFD64E1DCB3DA835
2 changed files with 55 additions and 50 deletions

View File

@ -53,6 +53,7 @@ completion/available/pipx.completion.bash
completion/available/rustup.completion.bash completion/available/rustup.completion.bash
completion/available/vault.completion.bash completion/available/vault.completion.bash
completion/available/sdkman.completion.bash completion/available/sdkman.completion.bash
completion/available/wpscan.completion.bash
# aliases # aliases
# #

View File

@ -1,63 +1,67 @@
#!/usr/bin/bash # shellcheck shell=bash
if _command_exists wpscan; then if _command_exists wpscan; then
__wpscan_completion() { __wpscan_completion() {
local cur prev local cur prev
COMREPLY=() COMREPLY=()
cur=$(_get_cword) cur=$(_get_cword)
prev=$(_get_pword) prev=$(_get_pword)
local D=(--url --help --hh --version --ignore-main-redirect --banner --no-banner --max-scan-duration --format --output --detection-mode --user-agent --ua --http-auth --max-threads --throttle --request-timeout --connect-timeout --disable-tls-checks --proxy --proxy-auth --cookie-string --cookie-jar --force --update --no-update --api-token --wp-content-dir --wp-plugins-dir --enumerate --exclude-content-based --plugins-list --plugins-detection --plugins-version-all --plugins-version-detection --plugins-threshold --themes-list --themes-detection --themes-version-all --themes-version-detection --themes-threshold --timthumbs-list --timthumbs-detection --config-backups-list --config-backups-detection --db-exports-list --db-exports-detection --medias-detection --users-list --users-detection --passwords --usernames --multicall-max-passwords --password-attack --login-uri --stealthy --random-user-agent) # shellcheck disable=SC2207
local S=(-h -v -f -o -t -e -U -P) local OPTS=($(compgen -W "-h -v -f -o -t -e -U -P --url --help --hh --version --ignore-main-redirect --banner --no-banner --max-scan-duration --format --output --detection-mode --user-agent --ua --http-auth --max-threads --throttle --request-timeout --connect-timeout --disable-tls-checks --proxy --proxy-auth --cookie-string --cookie-jar --force --update --no-update --api-token --wp-content-dir --wp-plugins-dir --enumerate --exclude-content-based --plugins-list --plugins-detection --plugins-version-all --plugins-version-detection --plugins-threshold --themes-list --themes-detection --themes-version-all --themes-version-detection --themes-threshold --timthumbs-list --timthumbs-detection --config-backups-list --config-backups-detection --db-exports-list --db-exports-detection --medias-detection --users-list --users-detection --passwords --usernames --multicall-max-passwords --password-attack --login-uri --stealthy --random-user-agent"))
echo "${D[@]} ${S[@]}"
local OPTS=($(compgen -W "${S[@]} ${D[@]}"))
case $prev in case $prev in
# --format | -f) --format | -f)
# COMPREPLY=("$(compgen -W "cli cli-no-color json" "$cur")") # shellcheck disable=SC2207
# return 0 COMPREPLY=("$(compgen -W "cli cli-no-color json" "$cur")")
# ;; return 0
;;
# --detection-mode | *detection) --detection-mode | *detection)
# COMPREPLY=("$(compgen -W "mixed active passive" "$cur")") # shellcheck disable=SC2207
# return 0 COMPREPLY=("$(compgen -W "mixed active passive" "$cur")")
# ;; return 0
;;
# --enumerate | -e) --enumerate | -e)
# case $prev in case $prev in
# vp | ap | p) vp | ap | p)
# COMPREPLY=("$(compgen -W "vt at t tt cb dbe u m" "$cur")") # shellcheck disable=SC2207
# return 0 COMPREPLY=("$(compgen -W "vt at t tt cb dbe u m" "$cur")")
# ;; return 0
# vt | at | t) ;;
# COMPREPLY=("$(compgen -W "vp ap p tt cb dbe u m" "$cur")") vt | at | t)
# return 0 # shellcheck disable=SC2207
# ;; COMPREPLY=("$(compgen -W "vp ap p tt cb dbe u m" "$cur")")
# *) return 0
# COMPREPLY=("$(compgen -W "vp ap p vt at t tt cb dbe u m" "$cur")") ;;
# return 0 *)
# ;; # shellcheck disable=SC2207
# esac COMPREPLY=("$(compgen -W "vp ap p vt at t tt cb dbe u m" "$cur")")
# ;; return 0
;;
esac
;;
# --password-attack) --password-attack)
# COMPREPLY=("$(compgen -W "wp-login xmlrpc xmlrpc-multicall" "$cur")") # shellcheck disable=SC2207
# ;; COMPREPLY=("$(compgen -W "wp-login xmlrpc xmlrpc-multicall" "$cur")")
;;
## HANDLE ALL OTHER ## HANDLE ALL OTHER
*) *)
# COMPREPLY=("$(compgen -W "$OPTS" "$cur")") for OPT in "${OPTS[@]}"; do
for OPT in "${OPTS[@]}"; do if [[ "$OPT" == "$2"* ]]; then
if [[ "$OPT" == "$2"* ]]; then # shellcheck disable=SC2207
COMPREPLY+=("$OPT") COMPREPLY+=("$OPT")
fi fi
done done
;; ;;
esac esac
} }
complete -F __wpscan_completion wpscan complete -F __wpscan_completion wpscan
fi fi