#!/bin/bash # Get the current git config list gc_ls="$(git config --list)" # ANSI color codes RED='\033[0;31m' CYAN='\033[0;36m' YELLOW='\033[0;33m' GREEN='\033[0;32m' BLUE='\033[0;34m' LIGHT_GREEN='\033[0;92m' BOLD='\033[1m' NC='\033[0m' # No Color echo_error() { printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2 } echo_warning() { printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1" } echo_gls() { printf "${BOLD}${YELLOW}%s${NC}\n" "$1" } echo_note() { printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1" } # Function to print colored text print_color() { printf "%b%s%b\n" "$1" "$2" "$NC" } # Check if the given command exists silently command_exists() { command -v "$@" >/dev/null 2>&1 } # Function to install a package if `curl` is available if command_exists curl; then install_pkg() { sh -c "$(curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/snippets/install_pkg.sh)" -- "$@" } else echo_error "curl is not installed, universal install disabled!" fi # Function for barebones Git setup gitBareBonesSetup() { echo_gls "Please enter your username: " read -r g_username echo_gls "Please enter your email: " read -r g_mail echo_gls "Please enter your default branch name " read -r g_branch git config --global user.name "$g_username" git config --global user.email "$g_mail" git config --global init.defaultBranch "$g_branch" echo_note "Barebones Git setup complete!" read >"$CREDENTIALS_FILE" echo "Credentials added for $g_domain in $CREDENTIALS_FILE" git config --global credential.helper store chmod 600 "$HOME/.git-credentials" read ${options[$i]}" else echo " ${options[$i]}" fi done } # Main function main() { if command_exists git; then main_menu