Dotfiles/install.sh
2026-05-08 12:38:20 -05:00

66 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
# --- Functions ---
# Styling
function styleColor {
# Arguments
color=$1
if [ "${color}" == "red" ]; then
echo -e "\e[0;31m"
elif [ "${color}" == "green" ]; then
echo -e "\e[0;32m"
elif [ "${color}" == "yellow" ]; then
echo -e "\e[0;33m"
elif [ "${color}" == "blue" ]; then
echo -e "\e[0;34m"
elif [ "${color}" == "purple" ]; then
echo -e "\e[0;35m"
elif [ "${color}" == "cyan" ]; then
echo -e "\e[0;36m"
fi
}
function styleColorRst {
echo -e "\e[0m"
}
function displayTitle {
# Arguments
title=$1
titleLen=${#title}
titleLen=$((titleLen + 2))
bars="+"
for (( i=0; i<${titleLen}; i++ )); do
bars="${bars}-"
done
bars="${bars}+"
echo -e "\n\n\t${bars}"
echo -e "\t| $(styleColor "purple")${title}$(styleColorRst) |"
echo -e "\t${bars}\n\n"
}
function displayQuestion {
printf>&2 "$(styleColor "blue")$1$(styleColorRst) $(styleColor "cyan")[$2]$(styleColorRst): "
read -r response
echo ${response}
}
function displayYesNo {
response=$(displayQuestion "$1" "y/N")
if [ "$response" == "y" ] || [ "$response" == "Y" ]; then
echo "yes"
else
echo "no"
fi
}
# Packages
# --- Entry Point ---
clear
displayTitle "OBJNULL Dotfile Installer"
echo -e "This script is designed to quickly install any required components"
echo -e "so that your system is up and running quick with a speedy shell.\n"
response=$(displayYesNo "Continue")
if [ ${response} != "yes" ]; then
echo -e "$(styleColor "red")Goodbye...$(styleColorRst)"
fi