mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
Made the theme selecting more "modular". It now downloads a new default (theme) if it doesn't exist, then that default gets automatically sourced.
This commit is contained in:
parent
393c74cf15
commit
9a3fc33caa
1 changed files with 14 additions and 5 deletions
19
oh-my-zsh.sh
19
oh-my-zsh.sh
|
|
@ -220,7 +220,7 @@ is_theme() {
|
||||||
|
|
||||||
is_default_theme() {
|
is_default_theme() {
|
||||||
local base_dir=$1
|
local base_dir=$1
|
||||||
builtin test -f $base_dir
|
builtin test -d $base_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -n "$ZSH_THEME" ]]; then
|
if [[ -n "$ZSH_THEME" ]]; then
|
||||||
|
|
@ -232,10 +232,19 @@ if [[ -n "$ZSH_THEME" ]]; then
|
||||||
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||||
else
|
else
|
||||||
echo "[oh-my-zsh] Theme '$ZSH_THEME' was not found, using default theme!"
|
echo "[oh-my-zsh] Theme '$ZSH_THEME' was not found, using default theme!"
|
||||||
if is_default_theme "$ZSH_CUSTOM"; then
|
if is_default_theme "$ZSH_CUSTOM" && ! is_theme "$ZSH_THEME" "robbyrussell"; then
|
||||||
source "$ZSH_CUSTOM/robbyrussell.zsh-theme"
|
if is_theme "$ZSH_CUSTOM/themes/" "robbyrussell"; then
|
||||||
elif is_default_theme "$ZSH_CUSTOM/themes"; then
|
source "$ZSH_CUSTOM/themes/robbyrussell.zsh-theme"
|
||||||
source "$ZSH_CUSTOM/themes/robbyrussell.zsh-theme"
|
else
|
||||||
|
echo "[oh-my-zsh] The default theme (robbyrussell) was not found, redownloading it!"
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
wget -qO $ZSH_CUSTOM/themes/robbyrussell.zsh-theme https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/themes/robbyrussell.zsh-theme
|
||||||
|
source "$ZSH_CUSTOM/robbyrussell.zsh-theme"
|
||||||
|
else
|
||||||
|
curl -s -o $ZSH_CUSTOM/themes/robbyrussell.zsh-theme https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/themes/robbyrussell.zsh-theme
|
||||||
|
source "$ZSH_CUSTOM/themes/robbyrussell.zsh-theme"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
elif is_default_theme "$ZSH/themes"; then
|
elif is_default_theme "$ZSH/themes"; then
|
||||||
source "$ZSH/themes/robbyrussell.zsh-theme"
|
source "$ZSH/themes/robbyrussell.zsh-theme"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue