58 lines
1.4 KiB
PowerShell
58 lines
1.4 KiB
PowerShell
# DashMail — quick push to Gitea
|
|
Set-Location $PSScriptRoot
|
|
|
|
Write-Host ""
|
|
Write-Host " DashMail — Push to Gitea" -ForegroundColor Cyan
|
|
Write-Host " ─────────────────────────────────────" -ForegroundColor DarkGray
|
|
|
|
# Show what has changed
|
|
$status = git status --short
|
|
if (-not $status) {
|
|
Write-Host ""
|
|
Write-Host " Nothing to commit — everything is up to date." -ForegroundColor Green
|
|
Write-Host ""
|
|
Read-Host " Press Enter to close"
|
|
exit 0
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host " Changed files:" -ForegroundColor Yellow
|
|
$status | ForEach-Object { Write-Host " $_" -ForegroundColor DarkYellow }
|
|
Write-Host ""
|
|
|
|
# Prompt for commit message
|
|
$msg = Read-Host " Commit message"
|
|
if (-not $msg.Trim()) {
|
|
Write-Host ""
|
|
Write-Host " Cancelled — no message entered." -ForegroundColor Red
|
|
Write-Host ""
|
|
Read-Host " Press Enter to close"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host ""
|
|
|
|
# Stage, commit, push
|
|
git add -A
|
|
git commit -m $msg
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host ""
|
|
Write-Host " Commit failed." -ForegroundColor Red
|
|
Read-Host " Press Enter to close"
|
|
exit 1
|
|
}
|
|
|
|
git push
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host ""
|
|
Write-Host " Pushed successfully." -ForegroundColor Green
|
|
} else {
|
|
Write-Host ""
|
|
Write-Host " Push failed — check your connection to Gitea." -ForegroundColor Red
|
|
}
|
|
|
|
Write-Host ""
|
|
Read-Host " Press Enter to close"
|