From 3440f16b567c246920a684088f71a6330418786b Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Fri, 15 Feb 2019 19:57:48 +0530 Subject: [PATCH] Wrap init in a function --- wish.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/wish.sh b/wish.sh index c94509f..1855bb4 100644 --- a/wish.sh +++ b/wish.sh @@ -1,17 +1,21 @@ #!/usr/bin/env bash -# Source all plugins -for i in ${WISH_PLUGINS[@]}; do - for j in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do - source "$j/wish/plugins/$i.sh" &> /dev/null && break +function wish_init() { + # Source all plugins + for i in ${WISH_PLUGINS[@]}; do + for j in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do + source "$j/wish/plugins/$i.sh" &> /dev/null && break + done + [[ $? -ne 0 ]] && echo "Plugin $i not found." >&2 done - [[ $? -ne 0 ]] && echo "Plugin $i not found." >&2 -done -# Source theme -WISH_THEME=${WISH_THEME:-plain} -for i in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do - source "$i/wish/themes/$WISH_THEME.sh" &> /dev/null && break -done + # Source theme + WISH_THEME=${WISH_THEME:-plain} + for i in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do + source "$i/wish/themes/$WISH_THEME.sh" &> /dev/null && break + done -[[ $? -ne 0 ]] && echo "Theme $WISH_THEME not found." >&2 + [[ $? -ne 0 ]] && echo "Theme $WISH_THEME not found." >&2 +} + +wish_init