mirror of
https://github.com/kevinnlsamuel/bak-old.git
synced 2025-12-06 10:05:58 +05:30
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:
27
bak-old.sh
27
bak-old.sh
@@ -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
|
||||
##################################
|
||||
|
||||
Reference in New Issue
Block a user