mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 08:23:14 +01:00
Add stopwatch to pull-repo.ps1
This commit is contained in:
parent
b29648cd42
commit
cfaa7b48da
@ -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])"
|
||||||
|
Loading…
Reference in New Issue
Block a user