Files
egutierrez 8f45b40528 feat: add bash shell utility functions
12 funciones Bash del dominio shell: utilidades de scripting (bash_log,
bash_colors, bash_check_deps, bash_confirm, bash_handle_error, bash_safe_run),
manipulacion de texto (convert_text_case), estructura de proyectos
(create_project_structure), y operaciones git (git_clean_branches,
git_log_visual, git_push_all_remotes, git_repo_status). Cada una con su
.sh y .md de frontmatter.
2026-04-12 13:54:15 +02:00

1.8 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path, source_repo, source_license, source_file
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path source_repo source_license source_file
bash_log function bash shell 1.0.0 impure bash_log_init() -> void; success(msg: string) -> void; info(msg: string) -> void; warning(msg: string) -> void; error(msg: string) -> void; debug(msg: string) -> void; progress(msg: string) -> void Funciones de logging con colores para scripts bash. Incluye niveles success/info/warning/error/debug/progress con escritura a archivo de log.
bash
log
logging
colors
terminal
bash_colors_bash_shell
false error_go_core
name desc
msg mensaje a mostrar y registrar en el archivo de log
mensaje formateado con colores en stdout/stderr y registro con timestamp en archivo de log (ERROR_LOG_FILE) false
bash/functions/shell/bash_log.sh https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git MIT scripts/lib/common.sh

Ejemplo

source bash/functions/shell/bash_log.sh
bash_log_init

success "Servicio iniciado correctamente"
info "Procesando 42 registros..."
warning "El puerto 8080 ya esta en uso"
error "No se pudo conectar a la base de datos"
debug "Valor de variable: $VAR"
progress "Descargando imagen Docker..."

Notas

Llama a bash_log_init una vez al inicio para configurar ERROR_LOG_FILE y DEBUG_MODE. Por defecto el log va a /tmp/script-errors-YYYYMMDD.log.

La variable de entorno DEBUG_MODE=1 activa los mensajes de debug a stderr y muestra timestamps en todos los logs.

error escribe a stderr; el resto a stdout. Todos los niveles escriben al archivo de log independientemente de DEBUG_MODE.

Fuente: sourcea bash_colors.sh automaticamente al cargarse.