Add main function to generate prompt

This commit is contained in:
Ceda EI 2019-02-16 00:16:17 +05:30
parent 3440f16b56
commit 4b36696590
1 changed files with 13 additions and 0 deletions

13
wish.sh
View File

@ -2,6 +2,8 @@
function wish_init() { function wish_init() {
# Source all plugins # Source all plugins
local i
local j
for i in ${WISH_PLUGINS[@]}; do 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
@ -18,4 +20,15 @@ function wish_init() {
[[ $? -ne 0 ]] && echo "Theme $WISH_THEME not found." >&2 [[ $? -ne 0 ]] && echo "Theme $WISH_THEME not found." >&2
} }
function wish_main() {
local prev=$?
PS1=""
local i
for i in $(seq 0 $((${#WISH_PLUGINS[@]} - 1))); do
wish_${WISH_PLUGINS[i]}_main $prev
done
}
wish_init wish_init
PROMPT_COMMAND="wish_main; $PROMPT_COMMAND"