completion/sqlmap: 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.

Apply `shfmt`, but `shellcheck` is an absolute mess, so don't add to `clean_files.txt` yet.
pull/1962/head
John D Pell 2021-09-19 10:40:27 -07:00 committed by John D Pell
parent 4dbe92e38d
commit c4e4846ae5
1 changed files with 148 additions and 152 deletions

View File

@ -7,11 +7,9 @@
# | # |
# ---------------------------------------------------------------------------+ # ---------------------------------------------------------------------------+
if _command_exists sqlmap _command_exists sqlmap || return
then
function _sqlmap() function _sqlmap() {
{
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
@ -143,10 +141,10 @@ then
--dependencies --disable-coloring --identify-waf \ --dependencies --disable-coloring --identify-waf \
--mobile --page-rank --purge-output --smart \ --mobile --page-rank --purge-output --smart \
--sqlmap-shell --wizard ' --sqlmap-shell --wizard '
COMPREPLY=( $( \ COMPREPLY=($(
(while read -d ' ' i; do (
[[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && while read -d ' ' i; do
continue [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && continue
# flatten array with spaces on either side, # flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of # otherwise we cannot grep on word boundaries of
# first and last word # first and last word
@ -154,7 +152,8 @@ then
# remove word from list of completions # remove word from list of completions
COMPREPLY=(${COMPREPLY/ ${i%% *} / }) COMPREPLY=(${COMPREPLY/ ${i%% *} / })
done done
printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" printf '%s ' "${COMPREPLY[@]}"
) <<< "${COMP_WORDS[@]}"
)) ))
#else #else
@ -162,7 +161,4 @@ then
fi fi
} }
complete -F _sqlmap sqlmap complete -F _sqlmap sqlmap
fi