From a4f05995bd058b3dc96818929932d1769516be46 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Jun 2025 20:27:04 +0000 Subject: [PATCH 1/2] Initial plan for issue From f6c737b5e49642e68edfbbd08bb5d28b259183dc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Jun 2025 20:37:01 +0000 Subject: [PATCH 2/2] Refactor colored install log format - implement log functions and update all install scripts Co-authored-by: andrejusk <7396847+andrejusk@users.noreply.github.com> --- script/install | 32 ++++++++++++++++++++++++++++ script/install.d/00-os.sh | 2 +- script/install.d/01-ssh.sh | 4 ++-- script/install.d/02-brew.sh | 2 +- script/install.d/03-apt.sh | 2 +- script/install.d/20-docker.sh | 8 +++---- script/install.d/30-iterm2.sh | 4 ++-- script/install.d/40-nerdfont.sh | 2 +- script/install.d/70-cca.sh | 2 +- script/install.d/71-rectangle.sh | 2 +- script/install.d/72-meetingbar.sh | 2 +- script/install.d/73-betterdisplay.sh | 2 +- script/install.d/74-dockutil.sh | 2 +- script/install.d/75-arc.sh | 2 +- script/install.d/76-appcleaner.sh | 2 +- script/install.d/81-cmatrix.sh | 6 +++--- script/install.d/97-macos.sh | 2 +- script/install.d/98-clean.sh | 2 +- 18 files changed, 56 insertions(+), 24 deletions(-) diff --git a/script/install b/script/install index d4a560a..1923f6d 100755 --- a/script/install +++ b/script/install @@ -6,6 +6,7 @@ set -eo pipefail # if [[ -t 1 && -n "$TERM" && "$TERM" != "dumb" ]]; then + BLUE="\033[0;34m" CYAN="\033[0;36m" CYAN_BOLD="\033[1;36m" RED="\033[1;31m" @@ -14,6 +15,9 @@ if [[ -t 1 && -n "$TERM" && "$TERM" != "dumb" ]]; then GREY="\033[1;30m" NC="\033[0m" else + BLUE="" + CYAN="" + CYAN_BOLD="" RED="" GREEN="" YELLOW="" @@ -21,6 +25,34 @@ else NC="" fi +# Log functions +log_info() { + echo -e "${BLUE}[INFO]${NC} $*" +} + +log_pass() { + echo -e "${GREEN}[PASS]${NC} $*" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $*" +} + +log_error() { + echo -e "${RED}[FAIL]${NC} $*" +} + +log_debug() { + echo -e "${CYAN}$*${NC}" +} + +# Export log functions so they're available in sourced scripts +export -f log_info +export -f log_pass +export -f log_warn +export -f log_error +export -f log_debug + printf "\n\t${CYAN} <<< ${CYAN_BOLD}dots${CYAN} >>> ${NC}\n" printf "\t${GREY}==============${NC}\n\n" diff --git a/script/install.d/00-os.sh b/script/install.d/00-os.sh index ce04239..e36f5c1 100644 --- a/script/install.d/00-os.sh +++ b/script/install.d/00-os.sh @@ -10,5 +10,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "linux-gnu"* ]]; then cat /etc/os-release else - echo -e "${RED}Unknown OS: $OSTYPE${NC}" + log_error "Unknown OS: $OSTYPE" fi diff --git a/script/install.d/01-ssh.sh b/script/install.d/01-ssh.sh index 41b5080..4c3f3e5 100644 --- a/script/install.d/01-ssh.sh +++ b/script/install.d/01-ssh.sh @@ -7,7 +7,7 @@ # skip if CODESPACES is set if [ -n "$CODESPACES" ]; then - echo -e "${YELLOW}Running in a GitHub Codespace${NC}" + log_warn "Running in a GitHub Codespace" export SKIP_SSH_CONFIG=1 fi @@ -29,5 +29,5 @@ if [ -z "$SKIP_SSH_CONFIG" ]; then unset ssh_method ssh_target ssh_key ssh_pub else - echo -e "${YELLOW}Skipping SSH configuration${NC}" + log_warn "Skipping SSH configuration" fi diff --git a/script/install.d/02-brew.sh b/script/install.d/02-brew.sh index 61cd294..ea0ee63 100644 --- a/script/install.d/02-brew.sh +++ b/script/install.d/02-brew.sh @@ -24,5 +24,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then fi brew --version else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/03-apt.sh b/script/install.d/03-apt.sh index c81792f..5cc75cd 100644 --- a/script/install.d/03-apt.sh +++ b/script/install.d/03-apt.sh @@ -21,5 +21,5 @@ if command -v apt-get &> /dev/null; then apt --version else - echo -e "${YELLOW}Skipping: apt-get not found${NC}" + log_warn "Skipping: apt-get not found" fi diff --git a/script/install.d/20-docker.sh b/script/install.d/20-docker.sh index dd8d085..aad327d 100644 --- a/script/install.d/20-docker.sh +++ b/script/install.d/20-docker.sh @@ -8,19 +8,19 @@ # skip if in WSL if [[ -n "$WSL_DISTRO_NAME" ]]; then - echo -e "${YELLOW}Running in WSL${NC}" + log_warn "Running in WSL" export SKIP_DOCKER_CONFIG=1 fi # skip if in CODESPACES if [[ -n "$CODESPACES" ]]; then - echo -e "${YELLOW}Running in GitHub Codespaces${NC}" + log_warn "Running in GitHub Codespaces" export SKIP_DOCKER_CONFIG=1 fi # skip on mac if [[ "$OSTYPE" == "darwin"* ]]; then - echo -e "${YELLOW}Running on macOS${NC}" + log_warn "Running on macOS" export SKIP_DOCKER_CONFIG=1 fi @@ -57,5 +57,5 @@ if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then fi docker --version else - echo -e "${YELLOW}Skipping Docker configuration${NC}" + log_warn "Skipping Docker configuration" fi diff --git a/script/install.d/30-iterm2.sh b/script/install.d/30-iterm2.sh index f718466..9817f96 100644 --- a/script/install.d/30-iterm2.sh +++ b/script/install.d/30-iterm2.sh @@ -9,7 +9,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then if ! brew list --cask iterm2 &>/dev/null; then brew install --cask iterm2 fi - echo -e "${GREEN}iTerm2 installed successfully!${NC}" + log_pass "iTerm2 installed successfully!" else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/40-nerdfont.sh b/script/install.d/40-nerdfont.sh index 2bddc0a..8da9127 100644 --- a/script/install.d/40-nerdfont.sh +++ b/script/install.d/40-nerdfont.sh @@ -20,5 +20,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then unset fonts_list else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/70-cca.sh b/script/install.d/70-cca.sh index b70bb1a..21afa4d 100644 --- a/script/install.d/70-cca.sh +++ b/script/install.d/70-cca.sh @@ -12,5 +12,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "Colour Contrast Analyser (CCA) is already installed." fi else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/71-rectangle.sh b/script/install.d/71-rectangle.sh index 279aa98..d94b986 100644 --- a/script/install.d/71-rectangle.sh +++ b/script/install.d/71-rectangle.sh @@ -12,5 +12,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "Rectangle is already installed." fi else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/72-meetingbar.sh b/script/install.d/72-meetingbar.sh index 5fa3297..fa3c933 100644 --- a/script/install.d/72-meetingbar.sh +++ b/script/install.d/72-meetingbar.sh @@ -12,5 +12,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "MeetingBar is already installed." fi else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/73-betterdisplay.sh b/script/install.d/73-betterdisplay.sh index 17e5a7a..bb70e08 100644 --- a/script/install.d/73-betterdisplay.sh +++ b/script/install.d/73-betterdisplay.sh @@ -12,5 +12,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "BetterDisplay is already installed." fi else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/74-dockutil.sh b/script/install.d/74-dockutil.sh index ce7258c..4423941 100644 --- a/script/install.d/74-dockutil.sh +++ b/script/install.d/74-dockutil.sh @@ -12,5 +12,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "dockutil is already installed." fi else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/75-arc.sh b/script/install.d/75-arc.sh index d250285..3f9c9b1 100644 --- a/script/install.d/75-arc.sh +++ b/script/install.d/75-arc.sh @@ -12,5 +12,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "Arc Browser is already installed." fi else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/76-appcleaner.sh b/script/install.d/76-appcleaner.sh index dceee93..f6a2fd2 100644 --- a/script/install.d/76-appcleaner.sh +++ b/script/install.d/76-appcleaner.sh @@ -13,5 +13,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "AppCleaner is already installed." fi else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/81-cmatrix.sh b/script/install.d/81-cmatrix.sh index 51dd379..c7ed4fd 100644 --- a/script/install.d/81-cmatrix.sh +++ b/script/install.d/81-cmatrix.sh @@ -7,7 +7,7 @@ # skip if in CODESPACES if [[ -n "$CODESPACES" ]]; then - echo -e "${YELLOW}Running in GitHub Codespaces${NC}" + log_warn "Running in GitHub Codespaces" export SKIP_CMATRIX_CONFIG=1 fi @@ -19,7 +19,7 @@ if [[ -z "$SKIP_CMATRIX_CONFIG" ]]; then brew install cmatrix fi fi - echo -e "${GREEN}cmatrix installed successfully!${NC}" + log_pass "cmatrix installed successfully!" else - echo -e "${YELLOW}Skipping cmatrix configuration${NC}" + log_warn "Skipping cmatrix configuration" fi diff --git a/script/install.d/97-macos.sh b/script/install.d/97-macos.sh index 507d396..55cad70 100644 --- a/script/install.d/97-macos.sh +++ b/script/install.d/97-macos.sh @@ -185,5 +185,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then killall Dock 2>/dev/null || true else - echo -e "${YELLOW}Skipping: Not macOS${NC}" + log_warn "Skipping: Not macOS" fi diff --git a/script/install.d/98-clean.sh b/script/install.d/98-clean.sh index 0e67414..be65f11 100644 --- a/script/install.d/98-clean.sh +++ b/script/install.d/98-clean.sh @@ -12,4 +12,4 @@ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then sudo apt-get clean -qq fi -echo -e "${GREEN}Cleanup completed successfully!${NC}" +log_pass "Cleanup completed successfully!"