[IMPROVED] Agregar selector de tipo de servidor git al crear proyectos
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8f13cca285
commit
59d8c34136
1 changed files with 45 additions and 0 deletions
|
@ -40,7 +40,9 @@ PROJECT_TYPE=""
|
|||
PROJECT_DESCRIPTION=""
|
||||
PROJECT_LICENSE=""
|
||||
PROJECT_LICENSE_TEXT=""
|
||||
PROJECT_GIT_SERVER=""
|
||||
VALID_TYPES=("ansible" "odoo" "sp32home" "nodejs" "python" "cobol" "php" "c" "cpp" "csharp" "rust" "otros")
|
||||
VALID_GIT_SERVERS=("github" "gitlab" "gitea" "forgejo" "none")
|
||||
|
||||
# Estructura de datos para licencias: nombre, badge, texto corto
|
||||
declare -A LICENSE_BADGES
|
||||
|
@ -274,6 +276,43 @@ function request_project_description() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Función para solicitar el tipo de servidor git
|
||||
function request_git_server() {
|
||||
# Construir las opciones para el diálogo
|
||||
OPTIONS=""
|
||||
for i in "${!VALID_GIT_SERVERS[@]}"; do
|
||||
if [ "${VALID_GIT_SERVERS[$i]}" == "github" ]; then
|
||||
# Seleccionar "github" como opción por defecto
|
||||
OPTIONS="$OPTIONS ${VALID_GIT_SERVERS[$i]} ${VALID_GIT_SERVERS[$i]} on"
|
||||
else
|
||||
OPTIONS="$OPTIONS ${VALID_GIT_SERVERS[$i]} ${VALID_GIT_SERVERS[$i]} off"
|
||||
fi
|
||||
done
|
||||
|
||||
dialog_input_radio "Seleccione el servidor Git" "Elija el tipo de servidor Git que utilizará para este proyecto" "$OPTIONS" 15 15 50
|
||||
|
||||
if [ $codex -ne 0 ]; then
|
||||
echo "${head_canceled}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROJECT_GIT_SERVER="$value"
|
||||
|
||||
# Validar que el servidor seleccionado sea válido
|
||||
VALID_SERVER=0
|
||||
for s in "${VALID_GIT_SERVERS[@]}"; do
|
||||
if [ "$s" == "$PROJECT_GIT_SERVER" ]; then
|
||||
VALID_SERVER=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $VALID_SERVER -eq 0 ]; then
|
||||
dialog_error_box "$head_error" "El tipo de servidor Git seleccionado no es válido"
|
||||
request_git_server
|
||||
fi
|
||||
}
|
||||
|
||||
# Función para crear la estructura del proyecto
|
||||
function create_project_structure() {
|
||||
# Crear la carpeta del proyecto
|
||||
|
@ -771,6 +810,9 @@ EOF
|
|||
# Guardar información de la licencia en un archivo
|
||||
echo "$PROJECT_LICENSE" > "$PROJECT_PATH/.license"
|
||||
|
||||
# Guardar información del servidor git en un archivo
|
||||
echo "$PROJECT_GIT_SERVER" > "$PROJECT_PATH/.gittype"
|
||||
|
||||
# Hacer commit inicial del proyecto
|
||||
cd "$PROJECT_PATH"
|
||||
git add .
|
||||
|
@ -799,6 +841,9 @@ function main() {
|
|||
# Solicitar descripción del proyecto
|
||||
request_project_description
|
||||
|
||||
# Solicitar tipo de servidor git
|
||||
request_git_server
|
||||
|
||||
# Crear estructura del proyecto
|
||||
create_project_structure
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue