diff --git a/bin/standardize_scripts.sh b/bin/standardize_scripts.sh index 14e4dfa..d7a4325 100755 --- a/bin/standardize_scripts.sh +++ b/bin/standardize_scripts.sh @@ -49,7 +49,8 @@ source "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/console.lib" load_messages "${BIN_HOME}/${BIN_BASE}" "${BIN_MESG}" "${BIN_LANG}" "head" # Variables globales -title="${head_000} ${head_002}" +title="${head_000} ${head_002} - ${head_002}" +apps_title="${head_000} - ${projmsg_007}" HEADER_TEMPLATE="${BIN_HOME}/${BIN_BASE}/${BIN_CFGS}/bash.head" VARIABLES_TEMPLATE="${BIN_HOME}/${BIN_BASE}/${BIN_CFGS}/bash.variables" DEFAULT_AUTHOR="Mauro Rosero P. " @@ -210,21 +211,41 @@ standardize_variables() { # Función principal main() { - echo "Estandarizando scripts Bash en $BIN_HOME/$BIN_BASE" + dialog_msg_box "$title" "${head_info}: ${head_002} $BIN_HOME/$BIN_BASE" # Verificar que existe la plantilla de encabezado if [ ! -f "$HEADER_TEMPLATE" ]; then - echo "Error: No se encuentra la plantilla de encabezado en $HEADER_TEMPLATE" + dialog_error_box "$title" "${head_error}: ${head_nobuild} $HEADER_TEMPLATE" exit 1 fi + # Verificar que existe la plantilla de variables + if [ ! -f "$VARIABLES_TEMPLATE" ]; then + dialog_error_box "$title" "${head_error}: ${head_nodockerfile} $VARIABLES_TEMPLATE" + exit 1 + fi + + # Contar scripts a procesar + local total_scripts=$(find "$BIN_HOME/$BIN_BASE" -name "*.sh" | wc -l) + local current=0 + + dialog_info_box "$title" "${head_info}: ${head_container} $total_scripts" + # Recorrer todos los scripts .sh en el directorio bin for script in "$BIN_HOME/$BIN_BASE"/*.sh; do + current=$((current + 1)) + # Saltar el script actual para evitar problemas if [ "$(basename "$script")" == "$(basename "$0")" ]; then + echo "[$current/$total_scripts] ${head_exit}: $(basename "$script")" continue fi + echo "[$current/$total_scripts] ${head_info}: $(basename "$script")" + + # Hacer una copia de seguridad del script + cp "$script" "${script}.bak" + # Extraer información del script local script_info=$(extract_script_info "$script") @@ -233,9 +254,11 @@ main() { # Estandarizar variables y estructura común standardize_variables "$script" + + echo " ✓ ${head_create}: $(basename "$script")" done - echo "Proceso de estandarización completado." + dialog_info_box "$title" "${head_builded} $current ${head_container}.\n\n${head_version}.bak" } # Ejecutar función principal