Add stop watch to clean-repo.ps1

This commit is contained in:
Markus Fleschutz 2021-05-19 07:33:57 +02:00
parent 48badc2b8e
commit 8748becdad

View File

@ -8,6 +8,8 @@
param($RepoDir = "$PWD")
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
$RepoDirName = (get-item "$RepoDir").Name
@ -22,7 +24,8 @@ try {
& git -C "$RepoDir" submodule foreach --recursive git clean -fdx
if ($lastExitCode -ne "0") { throw "'git clean -fdx' in submodules failed" }
"✔️ cleaned Git repository 📂$RepoDirName"
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ cleaned Git repository 📂$RepoDirName in $Elapsed sec."
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"