From 84c96665ce03cbaa904c0120a5e9f48015ee796a Mon Sep 17 00:00:00 2001 From: John D Pell Date: Thu, 23 Sep 2021 14:51:21 -0700 Subject: [PATCH] completion/wpscan: simplify code flow (whitespace) Convert from indented if-block to return then unindented code. This should have basically one line change at the top, one line removed at the bottom, and then all whitespace. --- completion/available/wpscan.completion.bash | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/completion/available/wpscan.completion.bash b/completion/available/wpscan.completion.bash index 8891ab7f..105468a3 100644 --- a/completion/available/wpscan.completion.bash +++ b/completion/available/wpscan.completion.bash @@ -1,15 +1,16 @@ # shellcheck shell=bash -if _command_exists wpscan; then - function __wpscan_completion() { - local OPTS=("--help --hh --version --url --ignore-main-redirect --verbose --output --format --detection-mode --scope --headers --user-agent --vhost --random-user-agent --user-agents-list --http-auth --max-threads --throttle --request-timeout --connect-timeout --disable-tlc-checks --proxy --proxy-auth --cookie-string --cookie-jar --cache-ttl --clear-cache --server --cache-dir --update --no-update --wp-content-dir --wp-plugins-dir --wp-version-detection --main-theme-detection --enumerate --exclude-content-based --plugins-list --plugins-detection --plugins-version-all --plugins-version-detection --themes-list --themes-detection --themes-version-all --themes-version-detection --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 --stealthy") - COMPREPLY=() - for _opt_ in "${OPTS[@]}"; do - if [[ "$_opt_" == "$2"* ]]; then - COMPREPLY+=("$_opt_") - fi - done - } +_command_exists wpscan || return - complete -F __wpscan_completion wpscan -fi +function __wpscan_completion() { + local _opt_ + local OPTS=('--help' '--hh' '--version' '--url' '--ignore-main-redirect' '--verbose' '--output' '--format' '--detection-mode' '--scope' '--headers' '--user-agent' '--vhost' '--random-user-agent' '--user-agents-list' '--http-auth' '--max-threads' '--throttle' '--request-timeout' '--connect-timeout' '--disable-tlc-checks' '--proxy' '--proxy-auth' '--cookie-string' '--cookie-jar' '--cache-ttl' '--clear-cache' '--server' '--cache-dir' '--update' '--no-update' '--wp-content-dir' '--wp-plugins-dir' '--wp-version-detection' '--main-theme-detection' '--enumerate' '--exclude-content-based' '--plugins-list' '--plugins-detection' '--plugins-version-all' '--plugins-version-detection' '--themes-list' '--themes-detection' '--themes-version-all' '--themes-version-detection' '--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' '--stealthy') + COMPREPLY=() + for _opt_ in "${OPTS[@]}"; do + if [[ "$_opt_" == "$2"* ]]; then + COMPREPLY+=("$_opt_") + fi + done +} + +complete -F __wpscan_completion wpscan