allow changetheme to take a theme name

This commit is contained in:
Joel Holdbrooks 2011-06-06 23:36:14 -07:00
commit 8a577e77af

View file

@ -21,26 +21,30 @@ function usetheme() {
# Change themes through a menu style prompt # Change themes through a menu style prompt
function changetheme() { function changetheme() {
theme_files=($ZSH_THEMES_PATH/*) if [ $1 ]; then
theme_names=(${${theme_files[@]##*/}[@]%.zsh-theme}) usetheme "$1"
else
theme_files=($ZSH_THEMES_PATH/*)
theme_names=(${${theme_files[@]##*/}[@]%.zsh-theme})
PS3="Enter your selection: " PS3="Enter your selection: "
SELECTION="" SELECTION=""
echo "Themes available:" echo "Themes available:"
select theme in ${theme_names[@]} Quit select theme in ${theme_names[@]} Quit
do do
case $theme in case $theme in
Quit) Quit)
echo "Exiting... " echo "Exiting... "
exit;; exit;;
*) *)
SELECTION=$REPLY SELECTION=$REPLY
break break
;; ;;
esac esac
done done
theme="${theme_names[$SELECTION]}" theme="${theme_names[$SELECTION]}"
usetheme $theme usetheme $theme
fi
} }