From 3f0c0d4e0946437e2d8a989a46239f3687075b1d Mon Sep 17 00:00:00 2001 From: Marco Gallegos Date: Thu, 20 Nov 2025 20:42:05 -0600 Subject: [PATCH] feat: Add document templates and a module to install them to ~/Templates. --- doc_templates/bash.sh | 0 doc_templates/docker-compose.yml | 0 doc_templates/env.example | 0 doc_templates/index.html | 0 doc_templates/java.js | 0 doc_templates/json.json | 0 doc_templates/pyton.py | 0 doc_templates/readme.md | 0 doc_templates/styles.css | 0 doc_templates/texto.txt | 0 modules/doc_templates.sh | 50 ++++++++++++++++++++++++++++++++ omarchy-setup.sh | 1 + 12 files changed, 51 insertions(+) create mode 100644 doc_templates/bash.sh create mode 100644 doc_templates/docker-compose.yml create mode 100644 doc_templates/env.example create mode 100644 doc_templates/index.html create mode 100644 doc_templates/java.js create mode 100644 doc_templates/json.json create mode 100644 doc_templates/pyton.py create mode 100644 doc_templates/readme.md create mode 100644 doc_templates/styles.css create mode 100644 doc_templates/texto.txt create mode 100755 modules/doc_templates.sh diff --git a/doc_templates/bash.sh b/doc_templates/bash.sh new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/docker-compose.yml b/doc_templates/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/env.example b/doc_templates/env.example new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/index.html b/doc_templates/index.html new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/java.js b/doc_templates/java.js new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/json.json b/doc_templates/json.json new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/pyton.py b/doc_templates/pyton.py new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/readme.md b/doc_templates/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/styles.css b/doc_templates/styles.css new file mode 100644 index 0000000..e69de29 diff --git a/doc_templates/texto.txt b/doc_templates/texto.txt new file mode 100644 index 0000000..e69de29 diff --git a/modules/doc_templates.sh b/modules/doc_templates.sh new file mode 100755 index 0000000..a2032fa --- /dev/null +++ b/modules/doc_templates.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# +# Módulo para copiar plantillas de documentos al directorio ~/Templates. +# + +SCRIPT_DIR_MODULE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SCRIPT_DIR_ROOT="$(cd "${SCRIPT_DIR_MODULE}/.." && pwd)" + +if [[ -f "${SCRIPT_DIR_MODULE}/common.sh" ]]; then + source "${SCRIPT_DIR_MODULE}/common.sh" +else + echo "Error: common.sh no encontrado." + exit 1 +fi + +install_doc_templates() { + log_step "Copiando plantillas de documentos" + + local src_dir="${SCRIPT_DIR_ROOT}/doc_templates" + if [[ ! -d "$src_dir" ]]; then + log_error "El directorio de plantillas no existe: ${src_dir}" + return 1 + fi + + local target_user="${SUDO_USER:-$USER}" + local target_home="$HOME" + if [[ -n "${SUDO_USER:-}" ]]; then + target_home="$(getent passwd "$target_user" 2>/dev/null | cut -d: -f6)" + if [[ -z "$target_home" ]]; then + target_home="$(eval echo "~${target_user}")" + fi + fi + target_home="${target_home:-$HOME}" + + local dest_dir="${target_home}/Templates" + if [[ ! -d "$dest_dir" ]]; then + log_info "Creando directorio ${dest_dir}..." + if ! mkdir -p "$dest_dir"; then + log_error "No se pudo crear el directorio destino." + return 1 + fi + fi + + if ! cp -a "${src_dir}/." "$dest_dir/"; then + log_error "No se pudieron copiar las plantillas a ${dest_dir}" + return 1 + fi + + log_success "Plantillas copiadas a ${dest_dir}" +} diff --git a/omarchy-setup.sh b/omarchy-setup.sh index 77ed478..52316ec 100755 --- a/omarchy-setup.sh +++ b/omarchy-setup.sh @@ -136,6 +136,7 @@ MODULES=( ["F"]="disk-format;run_module_main;💾 Habilitar Formatos FAT/exFAT/NTFS/ext4;bg" ["R"]="davinci-resolve;install_davinci_resolve;🎬 Instalar DaVinci Resolve (Intel Edition);fg" ["H"]="hyprland-config;run_module_main;🎨 Instalar Configuración de Hyprland;bg" + ["T"]="doc_templates;install_doc_templates;📄 Copiar Plantillas de Documentos a ~/Templates;bg" ) # Módulos a excluir de la opción "Instalar Todo"