Source config file. Add WISH_CONFIG_FILE array for paths of config files.

This commit is contained in:
Ceda EI 2019-12-31 11:55:23 +05:30
parent 9a2d831432
commit 186675ae4e
1 changed files with 17 additions and 1 deletions

18
wish.sh
View File

@ -10,10 +10,26 @@ function wish_print_right_prompt() {
} }
function wish_init() { 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 # Source all plugins
local plugin local plugin
local path 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 for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
source "$path/wish/plugins/$plugin.sh" &> /dev/null && break source "$path/wish/plugins/$plugin.sh" &> /dev/null && break
done done