Wrap init in a function

This commit is contained in:
Ceda EI 2019-02-15 19:57:48 +05:30
parent 30671c610f
commit 3440f16b56
1 changed files with 16 additions and 12 deletions

20
wish.sh
View File

@ -1,17 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Source all plugins function wish_init() {
for i in ${WISH_PLUGINS[@]}; do # Source all plugins
for i in ${WISH_PLUGINS[@]}; do
for j in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do for j in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
source "$j/wish/plugins/$i.sh" &> /dev/null && break source "$j/wish/plugins/$i.sh" &> /dev/null && break
done done
[[ $? -ne 0 ]] && echo "Plugin $i not found." >&2 [[ $? -ne 0 ]] && echo "Plugin $i not found." >&2
done done
# Source theme # Source theme
WISH_THEME=${WISH_THEME:-plain} WISH_THEME=${WISH_THEME:-plain}
for i in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do for i in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
source "$i/wish/themes/$WISH_THEME.sh" &> /dev/null && break source "$i/wish/themes/$WISH_THEME.sh" &> /dev/null && break
done done
[[ $? -ne 0 ]] && echo "Theme $WISH_THEME not found." >&2 [[ $? -ne 0 ]] && echo "Theme $WISH_THEME not found." >&2
}
wish_init