From 406313e975fac81851a583e4f90ba1596027d9c6 Mon Sep 17 00:00:00 2001 From: Marco Gallegos Date: Thu, 20 Nov 2025 22:36:44 -0600 Subject: [PATCH] feat: Implement script logging and ignore generated log files. --- .gitignore | 1 + vanity_setup.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07d322c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.logs/ diff --git a/vanity_setup.sh b/vanity_setup.sh index d38e26e..6117e14 100644 --- a/vanity_setup.sh +++ b/vanity_setup.sh @@ -2,6 +2,20 @@ set -euo pipefail +SCRIPT_PATH=${BASH_SOURCE[0]:-$0} +if [[ "$SCRIPT_PATH" == "bash" || "$SCRIPT_PATH" == "-bash" ]]; then + SCRIPT_DIR="$PWD" +else + SCRIPT_DIR=$(cd "$(dirname "$SCRIPT_PATH")" >/dev/null 2>&1 && pwd -P) || SCRIPT_DIR="$PWD" +fi + +LOG_DIR="$SCRIPT_DIR/.logs" +mkdir -p "$LOG_DIR" +LOG_FILE="$LOG_DIR/vanity-$(date +%Y%m%d-%H%M%S).log" +touch "$LOG_FILE" +exec > >(tee -a "$LOG_FILE") 2>&1 +echo "Log de instalación: $LOG_FILE" + readonly POSH_THEME_URL="https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin.omp.json" readonly ZSHRC_URL="https://raw.githubusercontent.com/marcogll/mac_vntySet/main/.zshrc.example" readonly POSH_THEME_PATH="$HOME/.poshthemes/catppuccin.omp.json"