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