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 ac9965220d
commit 8f45b40528
24 changed files with 1522 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
---
name: convert_text_case
kind: function
lang: bash
domain: shell
version: "1.0.0"
purity: impure
signature: "convert_text_case(mode: string, file: string, [output_file: string]) -> void"
description: "Convierte el contenido de un archivo de texto. Modos: upper (todo mayúsculas), lower (todo minúsculas), lf (normaliza saltos de línea a LF eliminando \\r), crlf (normaliza saltos a CRLF). Sin output_file imprime a stdout."
tags: [bash, text, convert, case, encoding]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params:
- name: mode
desc: "transformación a aplicar: upper|lower|lf|crlf (requerido)"
- name: file
desc: "ruta al archivo de entrada (requerido)"
- name: output_file
desc: "ruta al archivo de salida (opcional; default: stdout)"
output: "texto convertido a stdout o escrito en output_file; exit code 1 si el modo o archivo son inválidos"
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/shell/convert_text_case.sh"
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git"
source_license: "MIT"
source_file: "scripts/linux/conversores/conversor_texto.sh"
---
## Ejemplo
```bash
source bash/functions/shell/convert_text_case.sh
# Convertir a mayúsculas y mostrar en stdout
convert_text_case upper mi_archivo.txt
# Convertir a minúsculas y guardar en archivo
convert_text_case lower input.txt output_lower.txt
# Normalizar saltos de línea CRLF a LF
convert_text_case lf archivo_windows.txt archivo_unix.txt
# Añadir CRLF (para Windows)
convert_text_case crlf unix.txt windows.txt
```
## Notas
Usa `awk` para las conversiones de case (portable) y `sed` para los saltos de línea. La función no modifica el archivo original si se provee `output_file`. Sin `output_file` imprime directamente a stdout, útil para pipes.