Add stopwatch to pull-repo.ps1

This commit is contained in:
Markus Fleschutz 2021-04-28 07:41:12 +02:00
parent b29648cd42
commit cfaa7b48da

View File

@ -8,6 +8,8 @@
param($RepoDir = "$PWD") param($RepoDir = "$PWD")
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
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"
@ -20,7 +22,8 @@ try {
& git pull --recurse-submodules --jobs=4 & git pull --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { throw "'git pull' failed" } if ($lastExitCode -ne "0") { throw "'git pull' failed" }
"✔️ updated Git repository 📂$RepoDirName" [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ pulled updates for Git repository 📂$RepoDirName in $Elapsed sec."
exit 0 exit 0
} catch { } catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"