From 6b79a02669d4648bac44626c514e02f1898e05c2 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 20 Mar 2012 15:31:22 +0100 Subject: [Funcs] Preprint : added '-n' parameter --- 01_Internal.zsh | 12 +++++++++--- 02_Functions.zsh | 8 ++++---- 99_Exec.zsh | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/01_Internal.zsh b/01_Internal.zsh index 297f274..1e91763 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -77,7 +77,13 @@ __term_title() __preprint() { - local my_color i + local my_color i newline + if [ "$1" = "-n" ] + then + newline='n' + shift + fi + my_color=${2-"$_prompt_colors[generic]"} hbar=$T_ @@ -89,9 +95,9 @@ __preprint() if [ "$1" != "" ] then - print -Pn "${C_}$my_color;1${_C}${hbar}$T_$_tj_$_T${C_}0;$my_color${_C} $1 ${C_}0;$my_color;1${_C}$T_$_tm_$_tq_$_T\r${C_}0${_C}" + print -P$newline "${C_}$my_color;1${_C}${hbar}$T_$_tj_$_T${C_}0;$my_color${_C} $1 ${C_}0;$my_color;1${_C}$T_$_tm_$_tq_$_T\r${C_}0${_C}" else - print -Pn "${C_}$my_color;1${_C}${hbar}$T_$_tq_$_tq_$_tq_$_tq_$_tq_$_T${C_}0${_C}" + print -P$newline "${C_}$my_color;1${_C}${hbar}$T_$_tq_$_tq_$_tq_$_tq_$_tq_$_T${C_}0${_C}" fi } diff --git a/02_Functions.zsh b/02_Functions.zsh index 78bf7d3..567170a 100644 --- a/02_Functions.zsh +++ b/02_Functions.zsh @@ -41,9 +41,9 @@ when() if [ -s $TODAY_FILE ] then - __preprint "À ne pas manquer" $color[red] ; echo + __preprint "À ne pas manquer" $color[red] cat $TODAY_FILE - __preprint "" $color[red] ; echo + __preprint "" $color[red] echo fi | sed 's/^/ /' } @@ -54,9 +54,9 @@ todo() TODO=${=$(which -p todo | cut -d: -f2)} if [ $($TODO $@ | wc -l) -gt 0 ] then - __preprint "À faire" $color[yellow] && echo + __preprint "À faire" $color[yellow] $TODO $@ --force-colour - __preprint "" $color[yellow] && echo + __preprint "" $color[yellow] echo fi | sed 's/^/ /' } diff --git a/99_Exec.zsh b/99_Exec.zsh index 6e5cd07..e6e1db2 100644 --- a/99_Exec.zsh +++ b/99_Exec.zsh @@ -10,9 +10,9 @@ if __cmd_exists fortune then - __preprint "Pensée du jour" && echo + __preprint "Pensée du jour" fortune fr | fmt -s -w 74 - __preprint "" && echo + __preprint echo fi | sed 's/^/ /' -- cgit v1.2.3