diff --git a/gitUpdate.ps1 b/gitUpdate.ps1 index 0886249..4ceec1f 100644 --- a/gitUpdate.ps1 +++ b/gitUpdate.ps1 @@ -8,21 +8,40 @@ Write-Host "" $opcion = Read-Host "Seleccione una opción (1/2)" if ($opcion -eq "1") { - Write-Host "`nPASTE su mensaje de commit y presione CTRL+Z seguido de ENTER:" -ForegroundColor Yellow - $mensaje = @() - while ($line = Read-Host) { - $mensaje += $line + # Crear archivo temporal para el mensaje + $tempFile = [System.IO.Path]::GetTempFileName() + + Write-Host "`nAbriendo editor de texto..." -ForegroundColor Yellow + Write-Host "1. Pegue su mensaje de commit" + Write-Host "2. Guarde el archivo (Ctrl+S)" + Write-Host "3. Cierre el editor (Alt+F4 o X)" -ForegroundColor Green + Write-Host "" + + # Abrir notepad con el archivo temporal + notepad.exe $tempFile | Out-Null + + # Verificar que el archivo tenga contenido + if (-not (Test-Path $tempFile) -or (Get-Item $tempFile).Length -eq 0) { + Write-Host "No se ingresó ningún mensaje. Abortando..." -ForegroundColor Red + Remove-Item $tempFile -ErrorAction SilentlyContinue + exit } - $mensajeFinal = $mensaje -join "`n" } else { $mensajeFinal = Read-Host "`nIngrese el mensaje de commit" + + # Para mensajes simples, crear archivo temporal también + $tempFile = [System.IO.Path]::GetTempFileName() + Set-Content -Path $tempFile -Value $mensajeFinal -NoNewline } Write-Host "`nAgregando archivos..." git add . Write-Host "Creando commit..." -git commit -m $mensajeFinal +git commit -F $tempFile + +# Eliminar archivo temporal después del commit +Remove-Item $tempFile -ErrorAction SilentlyContinue Write-Host "Haciendo push a la rama develop..." $pushOutput = git push origin develop 2>&1