mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-17 02:01:01 +01:00
Add stop watch to clean-repo.ps1
This commit is contained in:
parent
48badc2b8e
commit
8748becdad
@ -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])"
|
||||
|
Loading…
Reference in New Issue
Block a user