tazpkg diff modules/getenv @ rev 876
modules getenv, get, install: provide --quiet option (don't display service messages, show errors only)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Mon Nov 30 01:45:37 2015 +0200 (2015-11-30) |
parents | 67996045442a |
children | 908bac5e1d8c |
line diff
1.1 --- a/modules/getenv Tue Nov 17 12:45:13 2015 +0200 1.2 +++ b/modules/getenv Mon Nov 30 01:45:37 2015 +0200 1.3 @@ -192,4 +192,33 @@ 1.4 1.5 CUR_DIR="$(pwd)" 1.6 1.7 + 1.8 +# Quiet functions 1.9 + 1.10 +saved_action='' 1.11 +qaction() { 1.12 + saved_action="$1" 1.13 + [ -z "$quiet" ] && action "$1"; 1.14 +} 1.15 + 1.16 +qstatus() { 1.17 + local ret_code=$? 1.18 + if [ -z "$quiet" ]; then 1.19 + test "$ret_code" -eq 0; status 1.20 + elif [ "$ret_code" -ne 0 ]; then 1.21 + # Show both action and it's status in the silent mode if error 1.22 + action "$saved_action" 1.23 + test 1 -eq 2; status 1.24 + fi 1.25 +} 1.26 + 1.27 +qtitle() { 1.28 + [ -z "$quiet" ] && title "$@"; 1.29 +} 1.30 + 1.31 +qfooter() { 1.32 + [ -z "$quiet" ] && footer "$@"; 1.33 +} 1.34 + 1.35 + 1.36 debug '-- end getenv --'