UPdate Script de Git
This commit is contained in:
@@ -1,37 +1,22 @@
|
|||||||
Clear-Host
|
Clear-Host
|
||||||
|
|
||||||
Write-Host "Opciones de commit:" -ForegroundColor Cyan
|
# Crear archivo temporal para el mensaje
|
||||||
Write-Host "1. Pegar mensaje de commit (recomendado para mensajes largos)"
|
$tempFile = [System.IO.Path]::GetTempFileName()
|
||||||
Write-Host "2. Escribir mensaje simple"
|
|
||||||
|
Write-Host "Abriendo editor de texto..." -ForegroundColor Cyan
|
||||||
|
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 ""
|
Write-Host ""
|
||||||
|
|
||||||
$opcion = Read-Host "Seleccione una opción (1/2)"
|
# Abrir notepad con el archivo temporal
|
||||||
|
notepad.exe $tempFile | Out-Null
|
||||||
|
|
||||||
if ($opcion -eq "1") {
|
# Verificar que el archivo tenga contenido
|
||||||
# Crear archivo temporal para el mensaje
|
if (-not (Test-Path $tempFile) -or (Get-Item $tempFile).Length -eq 0) {
|
||||||
$tempFile = [System.IO.Path]::GetTempFileName()
|
Write-Host "No se ingresó ningún mensaje. Abortando..." -ForegroundColor Red
|
||||||
|
Remove-Item $tempFile -ErrorAction SilentlyContinue
|
||||||
Write-Host "`nAbriendo editor de texto..." -ForegroundColor Yellow
|
exit
|
||||||
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
|
|
||||||
}
|
|
||||||
} 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..."
|
Write-Host "`nAgregando archivos..."
|
||||||
|
|||||||
Reference in New Issue
Block a user