From 6684422ff76cf773e89d2cc4df1edc4a673b94b2 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Mon, 20 Sep 2021 13:59:47 -0700 Subject: [PATCH] lib/preview: `shfmt` && `shellcheck` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix theme file path globbing when $BASH_IT contains any spaces. My apologies to future `git blame` hunters ♥ --- clean_files.txt | 1 + lib/preview.bash | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/clean_files.txt b/clean_files.txt index 184eceea..d186ad30 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -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 diff --git a/lib/preview.bash b/lib/preview.bash index 418839cd..ad9fa124 100644 --- a/lib/preview.bash +++ b/lib/preview.bash @@ -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