Add exit_code, bg_jobs plugins.

Minor fix to vcs.sh
This commit is contained in:
Ceda EI 2019-02-16 23:01:30 +05:30
parent 2ffe6cfd47
commit f1646abba6
3 changed files with 43 additions and 1 deletions

22
plugins/bg_jobs.sh Normal file
View File

@ -0,0 +1,22 @@
function wish_bg_jobs_start() {
return 0
}
function wish_bg_jobs_end() {
return 0
}
function wish_bg_jobs_set_colors() {
WISH_BG_JOBS_FG=${WISH_BG_JOBS_FG:-$WISH_DEFAULT_FG}
WISH_BG_JOBS_BG=${WISH_BG_JOBS_BG:-$WISH_DEFAULT_BG}
WISH_BG_JOBS_SUFFIX=${WISH_BG_JOBS_SUFFIX:-&}
}
function wish_bg_jobs_main() {
local x=$(jobs -p | wc -l)
if [[ $x == 0 ]]; then
wish_append $WISH_BG_JOBS_BG $WISH_BG_JOBS_FG ""
else
wish_append $WISH_BG_JOBS_BG $WISH_BG_JOBS_FG " $x$WISH_BG_JOBS_SUFFIX "
fi
}

20
plugins/exit_code.sh Normal file
View File

@ -0,0 +1,20 @@
function wish_exit_code_start() {
return 0
}
function wish_exit_code_end() {
return 0
}
function wish_exit_code_set_colors() {
WISH_EXIT_CODE_FG=${WISH_EXIT_CODE_FG:-$WISH_DEFAULT_FG}
WISH_EXIT_CODE_BG=${WISH_EXIT_CODE_BG:-$WISH_DEFAULT_BG}
}
function wish_exit_code_main() {
if [[ $1 == 0 ]]; then
wish_append $WISH_EXIT_CODE_BG $WISH_EXIT_CODE_FG ""
else
wish_append $WISH_EXIT_CODE_BG $WISH_EXIT_CODE_FG $1
fi
}

View File

@ -26,7 +26,7 @@ function wish_vcs_main() {
local add=$(echo "$op" | awk '{a += $1} END {print a}')
local del=$(echo "$op" | awk '{d += $2} END {print d}')
if [[ $add != 0 ]] && [[ $del != 0 ]]; then
if [[ $add != 0 ]] || [[ $del != 0 ]]; then
git="$git+$add -$del "
fi
wish_append $WISH_VCS_BG $WISH_VCS_FG "$git"