From 186675ae4eefcb25139c599ff39e3b773aebdf6f Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Tue, 31 Dec 2019 11:55:23 +0530 Subject: [PATCH] Source config file. Add WISH_CONFIG_FILE array for paths of config files. --- wish.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wish.sh b/wish.sh index d4cc42c..a139ea4 100644 --- a/wish.sh +++ b/wish.sh @@ -10,10 +10,26 @@ function wish_print_right_prompt() { } function wish_init() { + # Find default config file if WISH_CONFIG_FILE is unset + if [[ ! -v WISH_CONFIG_FILE ]]; then + for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do + if [[ -f "$path/wish/config.gie" ]]; then + WISH_CONFIG_FILE="$path/wish/config.gie" + break + fi + done + fi + # Source config files + for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do + if [[ -f "$path/wish/wish.py" ]]; then + source <($path/wish/wish.py ${WISH_CONFIG_FILE[@]}) + break + fi + done # Source all plugins local plugin local path - for plugin in ${WISH_PLUGINS[@]} ${WISH_RIGHT_PLUGINS[@]}; do + for plugin in ${WISH_PLUGINS_SOURCE[@]}; do for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do source "$path/wish/plugins/$plugin.sh" &> /dev/null && break done