diff --git a/bak-old.sh b/bak-old.sh index c56a36c..f35e4ca 100755 --- a/bak-old.sh +++ b/bak-old.sh @@ -11,7 +11,7 @@ version='0.1.0-beta' OLDIFS="$IFS" unset IFS ### error precautions -set -e +set -e ##################### debug(){ ### function to call when $DEBUG is set @@ -48,7 +48,7 @@ $(tput bold)OPTIONS$(tput sgr0) Help and Version -h display this help menu - -v print version + -v print version HERE } @@ -80,6 +80,16 @@ print_err(){ exit 1 } +print_err_deps(){ + tput setaf 1 + cat <<- EOF + ${0##*/} has the following unmet dependencies: + ${1/:/\\n} + EOF + tput sgr0 + exit 1 +} + copy_succ(){ echo " ✅ $(tput setaf 2; tput bold)${1}.${2:-bak}$(tput sgr0)" } @@ -168,6 +178,23 @@ parse_combined(){ ${DEBUG+debug} ### ### if $DEBUG is set ### +############################################################################### +# CHECKING DEPS +################## +deps=(realpath) + +for dep in $deps; do + if command -v "$dep"; then + continue + else + missing="${dep}:" + fi +done + +if [[ -n ${missing} ]]; then + print_err_deps $missing +fi + ############################################################################### # SANITISING PARAMS AND OPTIONS ##################################