feat(install, update-repo): allow standalone installation, improvements

no need to clone repository to run the script anymoregit add install.sh update-repo.sh utils.sh
This commit is contained in:
retrozinndev
2025-07-31 19:40:16 -03:00
parent 295382d268
commit f30316fa19
3 changed files with 125 additions and 93 deletions
+32 -14
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# This script contains useful functions to be used
# in other scripts from retrozindev's dotfiles.
# in other scripts from colorshell.
# ----------
# Made by retrozinndev (João Dias)
# Licensed under the MIT License
@@ -23,6 +23,11 @@ config_dirs=(
"ags"
)
# -------------
# The repository's api url
# -------------
repo_api_url=https://api.github.com/repos/retrozinndev/colorshell
# -------------
# Sends stdout log with type and message provided
# in parameters.
@@ -30,29 +35,22 @@ config_dirs=(
# param $2 log message
# -------------
function Send_log() {
log_message=$2
log_message=`[[ -z $2 ]] && echo $1 || echo $2`
color="\e[34m"
log_type="info"
case ${1,,} in
"^warn(ing)$")
case "${1,,}" in
warn)
color="\e[33m"
log_type="warning"
;;
"^err(or)$")
err)
color="\e[31m"
log_type="error"
;;
*)
color="\e[34m"
log_type="info"
;;
esac
if [[ -z $2 ]]; then
log_message=$1
fi
echo -e "${color}[$log_type]\e[0m $log_message"
}
@@ -67,3 +65,23 @@ function Print_header() {
echo "#############################"
printf "\n"
}
# -------------
# Ask a yes/no question to user
# Input answer is exported as $answer
# -------------
function Ask() {
read -n 1 -p "$1 [y/n] " r
printf '\n'
export answer=$r
}
# -------------
# Ask a yes/no question to user
# Input answer is exported as $answer
# -------------
function Choose() {
read -n 1 -p "$1 [y/n] " r
printf '\n'
export answer=$r
}