diff --git a/bin/cversadm_token.sh b/bin/cversadm_token.sh index f0c6384..6a12b38 100755 --- a/bin/cversadm_token.sh +++ b/bin/cversadm_token.sh @@ -29,15 +29,17 @@ BIN_BASE="bin" BIN_LIBS="lib" BIN_MESG="msg" -# Definir head_error para uso en funciones +# Definir variables necesarias para uso en funciones head_error="ERROR" +head_exit="Salir" +head_key_end="END" # Importar bibliotecas necesarias source "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/base.lib" source "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/console.lib" # Cargar mensajes en español -load_messages "${BIN_HOME}" "${BIN_MESG}" "es" "developers" +load_messages "${BIN_HOME}/${BIN_BASE}" "${BIN_MESG}" "es" "developers" # Variables globales title="MRDevs Tools" @@ -60,21 +62,23 @@ ensure_developers_dir() { fi } -# Función para seleccionar la plataforma de control de versiones +# Función para seleccionar la plataforma de control de versiones usando menu_actions select_platform() { - # Crear opciones del menú utilizando un formato compatible con dialog_input_menu - local options="1 ${cvmsg_010} 2 ${cvmsg_011} 3 ${cvmsg_012}" + # Preparar opciones para menu_actions + local menu_options="1:${cvmsg_010} +2:${cvmsg_011} +3:${cvmsg_012}" - # Incrementar filas para evitar problemas de espacio - dialog_input_menu "${cvmsg_001}" "${cvmsg_002}" "$options" 15 70 + # Usar menu_actions en lugar de dialog_input_menu + local selection=$(menu_actions "${cvmsg_002}" "$menu_options" 5) # Verificar si hubo cancelación o error - if [ $codex -ne 0 ]; then + if [ "$selection" = "${head_key_end}" ]; then return 1 fi # Interpretar la selección - case $value in + case $selection in 1) echo "github" ;; 2) echo "gitlab" ;; 3) echo "forgejo" ;; @@ -137,6 +141,15 @@ main() { check_sops_installed ensure_developers_dir + # Asegurar que head_000 y head_002 estén definidos para el título + if [ -z "$head_000" ] || [ -z "$head_002" ]; then + head_000="MRDevs" + head_002="Tools" + fi + + # Mostrar título inicial + display_text_header + # Seleccionar plataforma platform=$(select_platform) if [ $? -ne 0 ]; then