From 97e0ab7de5f92b375715cc5c3e082fccdb809b13 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 10 Mar 2018 19:35:49 +0800 Subject: Add DEBUG var, debug() and warn() functions --- dfly-update | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dfly-update b/dfly-update index 33f2cbf..c76d45e 100755 --- a/dfly-update +++ b/dfly-update @@ -9,6 +9,8 @@ set -e +DEBUG=${DEBUG:-""} + NAME="dfly-update" VERSION="0.?.?" TOOLDIR="${0%/*}" @@ -41,6 +43,14 @@ UPDATE_BRANCH= # Helper Functions # +debug() { + [ -n "${DEBUG}" ] && echo "DEBUG: $@" >&2 +} + +warn() { + echo "WARNING: $@" >&2 +} + error() { echo "ERROR: $@" >&2 } -- cgit v1.2.2