From 80fbf9030738cbfea38bdd6a049ea828882328dd Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 6 Jun 2012 10:52:49 +0200 Subject: [Prompt] FANTASTIC STUFF : extensible prompt with TASKBAR and EXTRA_INFO --- net:foret/Colors.zsh | 2 ++ net:foret/Prompts.zsh | 37 +++++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) (limited to 'net:foret') diff --git a/net:foret/Colors.zsh b/net:foret/Colors.zsh index 100c30e..ffe5758 100644 --- a/net:foret/Colors.zsh +++ b/net:foret/Colors.zsh @@ -4,4 +4,6 @@ typeset -A _make_colors _make_colors[target]="31;1" _make_colors[verbose]="33;1" _make_colors[nproc]="33;1" +_make_colors[static]="32;1" +_make_colors[dynamic]="33;1" diff --git a/net:foret/Prompts.zsh b/net:foret/Prompts.zsh index 817330f..3524614 100644 --- a/net:foret/Prompts.zsh +++ b/net:foret/Prompts.zsh @@ -10,29 +10,38 @@ _prompt_colors[target]="1;31" -__compilation () +__static_dynamic () { - unset COMPILATION - if [ -n "$TARGET" -o -n "$STATIC" -o -n "$DYNAMIC" -o $(( ${V:-0} + ${NPROC:-0} )) -gt 0 ] - then - COMPILATION="[" - [ $(( ${STATIC:-$(( 1 ^ ${DYNAMIC:-0} ))} + ${DYNAMIC:-$(( 1 ^ ${STATIC:-0} ))} )) -lt 2 ] && \ case "${STATIC:-$(( 1 ^ ${DYNAMIC:-0} ))}${DYNAMIC:-$((1 ^ ${STATIC:-0}))}" in "10") - COMPILATION+=$C_$_make_colors[dynamic]$_C"static"$C_$_prompt_colors[soft_generic]$_C ;; + echo $C_$_make_colors[static]$_C"static" ;; "01") - COMPILATION+=$C_$_make_colors[target]$_C"dynamic"$C_$_prompt_colors[soft_generic]$_C ;; + echo $C_$_make_colors[dynamic]$_C"dynamic" ;; esac +} - COMPILATION+=$C_$_make_colors[target]$_C$TARGET$C_$_prompt_colors[soft_generic]$_C +__compilation_target () +{ + [ -n "$TARGET" ] && echo $C_$_make_colors[target]$_C$TARGET +} +__verbose_compilation () +{ [ -n "$V" -a "$V" -gt 0 ] && \ - COMPILATION+=$C_$_make_colors[verbose]$_C$(for i in {1..$V} ; echo -n "V")$C_$_prompt_colors[soft_generic]$_C + echo $C_$_make_colors[verbose]$_C$(for i in {1..$V} ; echo -n "V") +} +__nproc_compilation () +{ [ -n "$NPROC" -a "$NPROC" -gt 0 ] && \ - COMPILATION+=$C_$_make_colors[nproc]$_C$(for i in {1..$NPROC} ; echo -n "|")$C_$_prompt_colors[soft_generic]$_C - - COMPILATION+="] " - fi + echo $C_$_make_colors[nproc]$_C$(for i in {1..$NPROC} ; echo -n "|") +} +__makeflags () +{ + echo $MAKEFLAGS } + +PS1_TASKBAR+=(__makeflags __verbose_compilation __nproc_compilation) +PS1_EXTRA_INFO+=(__static_dynamic __compilation_target) + -- cgit v1.2.3