Improved output of sync-repo.ps1

This commit is contained in:
Markus Fleschutz 2021-04-22 10:22:29 +02:00
parent c58b33b7d8
commit c46fed2d97

View File

@ -1,6 +1,6 @@
<# <#
.SYNTAX sync-repo.ps1 [<repo-dir>] .SYNTAX sync-repo.ps1 [<repo-dir>]
.DESCRIPTION synchronizes a Git repository (pull&push, including submodules) .DESCRIPTION synchronizes a Git repository by pull & push (including submodules)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0 .NOTES Author: Markus Fleschutz / License: CC0
#> #>
@ -8,7 +8,7 @@
param($RepoDir = "$PWD") param($RepoDir = "$PWD")
try { try {
"⏳ Synchronizing Git repository $($RepoDir)..." "⏳ Synchronizing Git repository 📂$RepoDir ..."
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir" set-location "$RepoDir"
@ -22,7 +22,7 @@ try {
& git push & git push
if ($lastExitCode -ne "0") { throw "'git push' failed" } if ($lastExitCode -ne "0") { throw "'git push' failed" }
"✔️ Git repository $RepoDir synchronized" "✔️ synchronized Git repository 📂$RepoDir"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"