handling unmet dependencies

- will prompt if `realpath` does not exist
- need to work on the heredoc. insert new line for each dep
This commit is contained in:
kevinnls
2021-03-08 02:10:57 +05:30
parent 22571700a8
commit c64850df8d

View File

@@ -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
##################################