summaryrefslogtreecommitdiff
path: root/net:foret
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-06 10:52:49 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-06 10:56:02 +0200
commit80fbf9030738cbfea38bdd6a049ea828882328dd (patch)
treef44e324a7ff901d7aad7427fc0a4dd8a0855ae50 /net:foret
parentee6ff79beea6328e359d47de4dee4e5e6be890c2 (diff)
[Prompt] FANTASTIC STUFF : extensible prompt with TASKBAR and EXTRA_INFO
Diffstat (limited to 'net:foret')
-rw-r--r--net:foret/Colors.zsh2
-rw-r--r--net:foret/Prompts.zsh37
2 files changed, 25 insertions, 14 deletions
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)
+