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.
This commit is contained in:
2026-04-12 13:54:15 +02:00
parent 61c9042392
commit 61d8460149
24 changed files with 1522 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
---
name: bash_check_deps
kind: function
lang: bash
domain: shell
version: "1.0.0"
purity: impure
signature: "check_command(cmd: string, [error_code: string], [description: string]) -> void; check_commands(cmd...: string) -> void; check_directory(dir: string, [msg: string]) -> void; check_file(file: string, [msg: string]) -> void"
description: "Verifica existencia de comandos, directorios y archivos con output formateado. Complementa assert_command_exists con mensajes de error detallados y logging."
tags: [bash, check, dependency, command, exists, validation]
uses_functions: [bash_log_bash_shell]
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params:
- name: cmd
desc: "nombre del comando a verificar en PATH"
- name: error_code
desc: "codigo identificador del error; default COMMAND_NOT_FOUND"
- name: description
desc: "mensaje de error personalizado; default 'El comando CMD no esta disponible'"
- name: dir
desc: "ruta del directorio a verificar"
- name: file
desc: "ruta del archivo a verificar"
output: "exit code 0 si todas las verificaciones pasan; exit code 1 en caso de fallo con mensaje de error formateado"
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/shell/bash_check_deps.sh"
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git"
source_license: "MIT"
source_file: "scripts/lib/common.sh"
---
## Ejemplo
```bash
source bash/functions/shell/bash_check_deps.sh
check_command "docker" "DOCKER_NOT_FOUND" "Docker no esta instalado"
check_commands "git" "curl" "jq"
check_directory "/var/data" "El directorio de datos no existe"
check_file "/etc/config.yaml" "Falta el archivo de configuracion"
```
## Notas
`check_command` acepta un error_code y descripcion opcionales para mensajes mas descriptivos que `assert_command_exists`. Usa `debug` internamente para loggear cada verificacion.
`check_commands` verifica multiples comandos en una sola llamada y reporta todos los faltantes antes de retornar 1.
Sourcea `bash_log.sh` automaticamente, que a su vez sourcea `bash_colors.sh`. No es necesario sourcea dependencias por separado.