wish/wish.sh

35 lines
753 B
Bash
Raw Normal View History

2019-02-15 15:02:32 +01:00
#!/usr/bin/env bash
2019-02-15 15:27:48 +01:00
function wish_init() {
# Source all plugins
2019-02-15 19:46:17 +01:00
local i
local j
2019-02-15 15:27:48 +01:00
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
2019-02-15 15:02:32 +01:00
done
2019-02-15 15:27:48 +01:00
# 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
}
2019-02-15 15:02:32 +01:00
2019-02-15 19:46:17 +01:00
function wish_main() {
local prev=$?
PS1=""
local i
for i in $(seq 0 $((${#WISH_PLUGINS[@]} - 1))); do
wish_${WISH_PLUGINS[i]}_main $prev
done
}
2019-02-15 15:27:48 +01:00
wish_init
2019-02-15 19:46:17 +01:00
PROMPT_COMMAND="wish_main; $PROMPT_COMMAND"