base-files: upgrade: add vn and variants

To be used with in the following pattern

  vn "Remaining: "
  for p in $xx; do
    _vn "$p"
  done
  _v

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: maurerr <mariusd84@gmail.com>
This commit is contained in:
Yousong Zhou 2020-11-10 21:30:29 +08:00 committed by maurerr
parent 5fd24142d3
commit 5640e78d09

View File

@ -63,8 +63,20 @@ ask_bool() {
[ "$answer" -gt 0 ] [ "$answer" -gt 0 ]
} }
_v() {
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$*" >&2
}
_vn() {
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo -n "$*" >&2
}
v() { v() {
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$(date) upgrade: $@" >&2 _v "$(date) upgrade: $@"
}
vn() {
_vn "$(date) upgrade: $@"
} }
json_string() { json_string() {