4 Commits

Author SHA1 Message Date
97d9ae202a changed name with the correct extensions 2026-07-19 15:38:31 +01:00
b8dc56c275 Fixed installer for root user 2026-07-19 14:10:16 +01:00
Simone Cusano
7730f62cde added aliases script and root_git_highlight 2026-07-19 14:02:41 +01:00
fab6b7045f Updated the source ~/.bashrc 2026-07-19 13:48:12 +01:00
4 changed files with 84 additions and 6 deletions

View File

@@ -0,0 +1,69 @@
parse_git_branch() {
if git rev-parse --is-inside-work-tree &>/dev/null; then
status_output=$(git status --porcelain --branch 2>/dev/null)
branch=$(echo "$status_output" | head -n1 | sed -E 's/^## ([^ .]+).*/\1/')
ahead=$(echo "$status_output" | grep -o 'ahead [0-9]*' | awk '{print $2}')
behind=$(echo "$status_output" | grep -o 'behind [0-9]*' | awk '{print $2}')
staged=$(echo "$status_output" | grep -E '^[A-Z]' | wc -l)
modified=$(echo "$status_output" | grep -E '^.[A-Z]' | wc -l)
untracked=$(echo "$status_output" | grep -E '^\?\?' | wc -l)
GREEN_BOLD="\[\033[1;32m\]"
PURPLE_BOLD="\[\033[1;35m\]"
YELLOW_BOLD="\[\033[1;33m\]"
RED_BOLD="\[\033[1;31m\]"
CYAN_BOLD="\[\033[1;36m\]"
RESET="\[\033[0m\]"
git_status=""
[ "$staged" -gt 0 ] && git_status="${git_status}${GREEN_BOLD}+${staged}${RESET} "
[ "$modified" -gt 0 ] && git_status="${git_status}${YELLOW_BOLD}M:${modified}${RESET} "
[ "$untracked" -gt 0 ] && git_status="${git_status}${RED_BOLD}N:${untracked}${RESET} "
remote_status=""
[ -n "$ahead" ] && remote_status="${remote_status}${CYAN_BOLD}${ahead}${RESET}"
[ -n "$behind" ] && remote_status="${remote_status}${CYAN_BOLD}${behind}${RESET}"
if [ "$staged" -eq 0 ] && [ "$modified" -eq 0 ] && [ "$untracked" -eq 0 ]; then
branch_display="${GREEN_BOLD}${branch}${RESET}"
else
branch_display="${PURPLE_BOLD}${branch}${RESET}"
fi
output="(${branch_display}"
[ -n "$remote_status" ] && output="${output} ${remote_status}"
[ -n "$git_status" ] && output="${output} ${git_status}"
output=$(echo "$output" | sed 's/ $//')
output="${output})"
printf "%s" "$output"
fi
}
# 🎨 Palette
RED_DARK="\[\033[1;31m\]" # bold
RED_LIGHT="\[\033[1;91m\]" # bold
WHITE="\[\033[0;37m\]" # NON bold
YELLOW="\[\033[0;33m\]" # NON bold
PURPLE="\[\033[1;35m\]" # bold
GREEN="\[\033[1;32m\]"
BLUE="\[\033[1;34m\]"
RESET="\[\033[0m\]"
YELLOW_LIGHT="\[\033[0;93m\]"
set_prompt() {
if [ "$EUID" -eq 0 ]; then
# ☠️ ROOT
PS1="${RED_DARK}\u${RESET}${WHITE}@${RED_LIGHT}\h${RESET}:${YELLOW_LIGHT}\w${RESET}$(parse_git_branch) ${PURPLE}#${RESET} "
else
# 👤 USER
PS1="${GREEN}\u${RESET}@${BLUE}\h${RESET}:${PURPLE}\w${RESET}$(parse_git_branch) ${BLUE}>${RESET} "
fi
}
PROMPT_COMMAND=set_prompt

1
installer/04_aliases.sh Normal file
View File

@@ -0,0 +1 @@
alias ls="ls --color"

View File

@@ -82,8 +82,14 @@ done
# ======================== # ========================
# VARIABLES # VARIABLES
# ======================== # ========================
if [ "$selected_user" == "root" ]; then
home="/root"
bashrc="$home/.bashrc"
else
home="/home/$selected_user" home="/home/$selected_user"
bashrc="$home/.bashrc" bashrc="$home/.bashrc"
fi
mainfolder="$home/.bashrc.d" mainfolder="$home/.bashrc.d"
neededfolder="$mainfolder/scripts-needed" neededfolder="$mainfolder/scripts-needed"
@@ -140,7 +146,9 @@ echo "[ Installing default scripts... ]"
default_scripts=( default_scripts=(
"00_default.sh" "00_default.sh"
"01_git-cli-highlitgh.sh" "01_git-cli-highlitgh.sh"
"02_bashboard.sh" "02_git-cli-highlitgh-root.sh"
"03_bashboard.sh"
"04_aliases"
) )
for script in "${default_scripts[@]}"; do for script in "${default_scripts[@]}"; do
@@ -156,9 +164,11 @@ done
# APPLY CHANGES # APPLY CHANGES
# ======================== # ========================
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$bashrc" #source "$bashrc"
source ~/.bashrc
echo "[ Bashrc reloaded ]" echo "[ Bashrc reloaded ]"
pause
# ======================== # ========================
# FINAL MESSAGE # FINAL MESSAGE
# ======================== # ========================
@@ -177,5 +187,3 @@ echo ""
echo "##################################" echo "##################################"
echo " Thanks for using this script! " echo " Thanks for using this script! "
echo "##################################" echo "##################################"
pause