From 4b36696590bb9a64ec182cac55a9f4fd053f0784 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sat, 16 Feb 2019 00:16:17 +0530 Subject: [PATCH] Add main function to generate prompt --- wish.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wish.sh b/wish.sh index 1855bb4..f177a71 100644 --- a/wish.sh +++ b/wish.sh @@ -2,6 +2,8 @@ function wish_init() { # Source all plugins + local i + local j 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 @@ -18,4 +20,15 @@ function wish_init() { [[ $? -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 +PROMPT_COMMAND="wish_main; $PROMPT_COMMAND"