mirror of https://gitlab.com/ceda_ei/wish
Add main function to generate prompt
This commit is contained in:
parent
3440f16b56
commit
4b36696590
13
wish.sh
13
wish.sh
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue