mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Removes code duplication.
This commit is contained in:
parent
5938937e53
commit
d1ed6486b8
1 changed files with 8 additions and 4 deletions
|
|
@ -17,14 +17,16 @@ check_for_updates() {
|
||||||
find_plugin_paths() {
|
find_plugin_paths() {
|
||||||
ZSH_PLUGIN_PATHS=()
|
ZSH_PLUGIN_PATHS=()
|
||||||
local plugin
|
local plugin
|
||||||
|
local plugin_file
|
||||||
local plugin_path
|
local plugin_path
|
||||||
local zsh_path
|
local zsh_path
|
||||||
|
|
||||||
for plugin in $plugins; do
|
for plugin in $plugins; do
|
||||||
plugin_path="plugins/$plugin/$plugin.plugin.zsh"
|
plugin_path="plugins/$plugin/$plugin.plugin.zsh"
|
||||||
for zsh_path in $ZSH_CUSTOM $ZSH; do
|
for zsh_path in $ZSH_CUSTOM $ZSH; do
|
||||||
if [[ -f $zsh_path/$plugin_path ]]; then
|
plugin_file=$zsh_path/$plugin_path
|
||||||
ZSH_PLUGIN_PATHS+=$zsh_path/$plugin_path
|
if [[ -f $plugin_file ]]; then
|
||||||
|
ZSH_PLUGIN_PATHS+=$plugin_file
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -68,14 +70,16 @@ _source_zsh_theme() {
|
||||||
source "$RANDOM_THEME"
|
source "$RANDOM_THEME"
|
||||||
echo "[oh-my-zsh] Random theme '$theme_name' loaded..."
|
echo "[oh-my-zsh] Random theme '$theme_name' loaded..."
|
||||||
elif [[ $ZSH_THEME != '' ]]; then
|
elif [[ $ZSH_THEME != '' ]]; then
|
||||||
|
local theme_file
|
||||||
local theme_path
|
local theme_path
|
||||||
local zsh_path
|
local zsh_path
|
||||||
|
|
||||||
# custom themes take precedence over built-in themes!
|
# custom themes take precedence over built-in themes!
|
||||||
theme_path="themes/$ZSH_THEME.zsh-theme"
|
theme_path="themes/$ZSH_THEME.zsh-theme"
|
||||||
for zsh_path in $ZSH_CUSTOM $ZSH; do
|
for zsh_path in $ZSH_CUSTOM $ZSH; do
|
||||||
if [[ -f $zsh_path/$theme_path ]]; then
|
theme_file=$zsh_path/$theme_path
|
||||||
source $zsh_path/$theme_path
|
if [[ -f $theme_file ]]; then
|
||||||
|
source $theme_file
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue