generated from projects/testosmaximus
fix: enhance dependency checks and improve error messages in reset.sh
This commit is contained in:
parent
aa46a0fbc9
commit
75130c574c
32
reset.sh
32
reset.sh
@ -5,6 +5,36 @@ TEMPLATE_REMOTE="git@git.chipperfluff.at:projects/funkyFlaskTest.git"
|
||||
CONFIRM_MODULE=""
|
||||
SELF_PATH="$0"
|
||||
|
||||
# === Dependency check ===
|
||||
require() {
|
||||
if ! command -v "$1" &>/dev/null; then
|
||||
echo "❗ Missing dependency: $1"
|
||||
read -rp "👉 Install $1 now? (y/n): " confirm
|
||||
if [[ "$confirm" =~ ^[Yy]$ ]]; then
|
||||
if [[ -f /etc/debian_version ]]; then
|
||||
sudo apt-get update && sudo apt-get install -y "$1" || {
|
||||
echo "💥 Failed to install $1 via apt-get"
|
||||
exit 1
|
||||
}
|
||||
elif [[ "$(uname)" == "Darwin" ]]; then
|
||||
brew install "$1" || {
|
||||
echo "💥 Failed to install $1 via brew"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
echo "🤷 I don't know how to install $1 on this system."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "🚫 Cannot continue without $1"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
require git
|
||||
require jq
|
||||
|
||||
# === Parse CLI args ===
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
@ -15,7 +45,7 @@ while [[ $# -gt 0 ]]; do
|
||||
echo " $TEMPLATE_REMOTE"
|
||||
exit 0 ;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "❌ Unknown option: $1"
|
||||
exit 1 ;;
|
||||
esac
|
||||
shift
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user