Skip to content

Commit

Permalink
Don't store new theme unless it is selected correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
molovo committed Feb 27, 2017
1 parent 8600667 commit 6faa801
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/commands/theme.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ _zulu_theme() {
config_dir=${ZULU_CONFIG_DIR:-"${ZDOTDIR:-$HOME}/.config/zulu"}
config="${config_dir}/theme"

echo "$theme" >! $config

# Ensure promptinit is loaded
autoload -U promptinit && promptinit

# Test if theme prompt function exists.
# If not, print a pretty warn message.
if which prompt_${theme}_setup >/dev/null 2>&1; then
prompt ${theme}
return
if [[ $? -eq 0 ]]; then
echo "$theme" >! $config
echo "$(color green '') Theme set to $theme"
return
fi
fi

echo $(color red "Failed to load theme '${theme}'")
Expand Down

0 comments on commit 6faa801

Please sign in to comment.