From a9e8f10e35d41e7a8a6e13d0174333c5fee38473 Mon Sep 17 00:00:00 2001 From: MattWis Date: Sun, 4 Aug 2013 01:01:14 -0400 Subject: [PATCH 1/3] Add ability to preview themes --- lib/preview.bash | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/preview.bash diff --git a/lib/preview.bash b/lib/preview.bash new file mode 100644 index 00000000..ca100c13 --- /dev/null +++ b/lib/preview.bash @@ -0,0 +1,18 @@ +if [[ $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=$(echo $theme | sed "s/\//\n/g" | tail -1 | sed "s/.theme.bash//") + echo " + $BASH_IT_THEME" + echo "" | bash --init-file $BASH_IT/bash_it.sh -i + done +fi From 0c70325542296097307599883ffdaec1dca1ecfa Mon Sep 17 00:00:00 2001 From: Matt Wismer Date: Tue, 6 Jan 2015 16:50:44 -0500 Subject: [PATCH 2/3] Use basename instead of sed --- lib/preview.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview.bash b/lib/preview.bash index ca100c13..6e0d0357 100644 --- a/lib/preview.bash +++ b/lib/preview.bash @@ -10,7 +10,7 @@ then THEMES="$BASH_IT/themes/*/*.theme.bash" for theme in $THEMES do - BASH_IT_THEME=$(echo $theme | sed "s/\//\n/g" | tail -1 | sed "s/.theme.bash//") + BASH_IT_THEME=$(basename -s '.theme.bash' $theme) echo " $BASH_IT_THEME" echo "" | bash --init-file $BASH_IT/bash_it.sh -i From 28429de0f7a631120d071959ae2162df2eac035e Mon Sep 17 00:00:00 2001 From: Matt Wismer Date: Tue, 6 Jan 2015 16:54:22 -0500 Subject: [PATCH 3/3] Updated README.md with preview information --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5ab37632..5ef44c3c 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ There are a few bash it themes. If you've created your own custom prompts, I'd You can see the theme screenshots [here](https://github.com/revans/bash-it/wiki/Themes) +Alternatively, you can preview the themes in your own shell using `BASH_PREVIEW=true reload` + ## Misc ### Bash Profile Aliases