slitaz-base-files rev 329
libtaz.sh: add info() to display an info in same place than status()
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Mar 02 15:38:20 2017 +0100 (2017-03-02) |
parents | 133ee7fe8217 |
children | 65248d132cd2 |
files | rootfs/lib/libtaz.sh |
line diff
1.1 --- a/rootfs/lib/libtaz.sh Wed Mar 01 13:07:13 2017 +0200 1.2 +++ b/rootfs/lib/libtaz.sh Thu Mar 02 15:38:20 2017 +0100 1.3 @@ -67,6 +67,19 @@ 1.4 esac 1.5 } 1.6 1.7 +# Print info a la status way: info [color] [content] 1.8 +info() { 1.9 + local info="$2" 1.10 + case "$output" in 1.11 + raw|gtk) echo "$info" ;; 1.12 + html) echo " <span class=\"float-right color${1}\">$info</span>";; 1.13 + *) 1.14 + local char="$(echo $info | wc -L)" 1.15 + local in=$((7 + ${char})) 1.16 + indent $(($(get_cols) - ${in})) "[ $(colorize $1 $info) ]" ;; 1.17 + esac 1.18 +} 1.19 + 1.20 # Line separator 1.21 separator() { 1.22 [ -n "$quiet" ] && return