feat: Add document templates and a module to install them to ~/Templates.

This commit is contained in:
Marco Gallegos
2025-11-20 20:42:05 -06:00
parent d85b81dd0e
commit 3f0c0d4e09
12 changed files with 51 additions and 0 deletions

0
doc_templates/bash.sh Normal file
View File

View File

View File

0
doc_templates/index.html Normal file
View File

0
doc_templates/java.js Normal file
View File

0
doc_templates/json.json Normal file
View File

0
doc_templates/pyton.py Normal file
View File

0
doc_templates/readme.md Normal file
View File

0
doc_templates/styles.css Normal file
View File

0
doc_templates/texto.txt Normal file
View File

50
modules/doc_templates.sh Executable file
View File

@@ -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}"
}

View File

@@ -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"