8f45b40528
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.
1.7 KiB
1.7 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_confirm | function | bash | shell | 1.0.0 | impure | bash_confirm(prompt: string, [default: string]) -> exit_code | Dialogo interactivo de confirmacion y/n con valor por defecto configurable. Soporta respuestas yes/y/si. |
|
|
false | error_go_core |
|
exit code 0 si el usuario confirma (y/yes/si), exit code 1 si niega o acepta el default negativo | false | bash/functions/shell/bash_confirm.sh | https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git | MIT | scripts/lib/common.sh |
Ejemplo
source bash/functions/shell/bash_confirm.sh
# Con default no (muestra [y/N])
if bash_confirm "¿Deseas continuar?"; then
echo "Continuando..."
fi
# Con default yes (muestra [Y/n])
bash_confirm "¿Eliminar archivos temporales?" "y" && rm -rf /tmp/cache
Notas
El prompt muestra el default en mayuscula: [Y/n] cuando default=y, [y/N] cuando default=n. Si el usuario presiona Enter sin escribir, se usa el valor por defecto.
Acepta variantes: y, Y, yes, YES, si, SI como afirmativo. Cualquier otra respuesta se trata como negativo.
Usa colores de bash_colors para el prompt en amarillo. Requiere terminal interactiva (lee de stdin con read -r).