1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-09-28 09:27:35 +00:00

feat: dependencies check

This commit is contained in:
Natapat Samutpong 2022-01-26 21:48:24 +07:00
parent 32f5f422d3
commit 699710fb5b

View file

@ -14,6 +14,13 @@ clean_up() {
exit 0 exit 0
} }
clean_up_fail() {
tput rmcup
tput cnorm
echo "${1:-Installation failed! :(}"
exit 1
}
# --- Displaying --- # --- Displaying ---
print_menu() { print_menu() {
@ -78,6 +85,12 @@ run_menu() {
# --- Installation --- # --- Installation ---
check_installed() {
if ! [ -x "$(command -v $1)" ] then
clean_up_fail "Please check that you have $1 installed!"
fi
}
install() { install() {
local selected_install_item=0 local selected_install_item=0
local install_opts=("Download" "Compile" "Compile(Debug)" "Exit") local install_opts=("Download" "Compile" "Compile(Debug)" "Exit")
@ -87,6 +100,9 @@ install() {
case "$install_chosen" in case "$install_chosen" in
0) echo "There is no release yet, please hold tight!";; 0) echo "There is no release yet, please hold tight!";;
1) 1)
echo "Testing dependencies..."
check_installed git
check_installed cargo
echo "Setting up folders..." echo "Setting up folders..."
mkdir -p ~/.cache/ mkdir -p ~/.cache/
rm -rf ~/.cache/bobbylisp/ rm -rf ~/.cache/bobbylisp/
@ -99,6 +115,9 @@ install() {
mv ~/.cache/bobbylisp/target/release/blspc ~/bin/blspc mv ~/.cache/bobbylisp/target/release/blspc ~/bin/blspc
clean_up "Done! Thanks a lot for trying out Bobbylisp!";; clean_up "Done! Thanks a lot for trying out Bobbylisp!";;
2) 2)
echo "Testing dependencies..."
check_installed git
check_installed cargo
echo "Setting up folders..." echo "Setting up folders..."
mkdir -p ~/.cache/ mkdir -p ~/.cache/
rm -rf ~/.cache/bobbylisp/ rm -rf ~/.cache/bobbylisp/