lib/preview: `shfmt` && `shellcheck`

Fix theme file path globbing when $BASH_IT contains any spaces.

My apologies to future `git blame` hunters ♥
pull/1904/head
John D Pell 2021-09-20 13:59:47 -07:00
parent 1506f9a6c9
commit 6684422ff7
2 changed files with 14 additions and 12 deletions

View File

@ -80,6 +80,7 @@ completion/available/wpscan.completion.bash
# libraries
lib/helpers.bash
lib/log.bash
lib/preview.bash
lib/search.bash
lib/utilities.bash

View File

@ -1,19 +1,20 @@
if [[ "${BASH_PREVIEW:-}" ]];
then
unset BASH_PREVIEW #Prevent infinite looping
echo "
# shellcheck shell=bash
#
# Displays the prompt from each _Bash It_ theme.
if [[ -n "${BASH_PREVIEW:-}" ]]; then
unset BASH_PREVIEW #Prevent infinite looping
echo "
Previewing Bash-it Themes
"
THEMES="$BASH_IT/themes/*/*.theme.bash"
for theme in $THEMES
do
BASH_IT_THEME=${theme%.theme.bash}
BASH_IT_THEME=${BASH_IT_THEME##*/}
echo "
for theme in "${BASH_IT?}/themes"/*/*.theme.bash; do
BASH_IT_THEME=${theme%.theme.bash}
BASH_IT_THEME=${BASH_IT_THEME##*/}
echo "
$BASH_IT_THEME"
echo "" | bash --init-file "${BASH_IT}/bash_it.sh" -i
done
echo "" | bash --init-file "${BASH_IT?}/bash_it.sh" -i
done
fi