Improve fetch-repos.ps1 and pull-repos.ps1

This commit is contained in:
Markus Fleschutz 2021-04-14 16:08:10 +02:00
parent f8ca4ed78b
commit e3c9ab459e
2 changed files with 9 additions and 2 deletions

View File

@ -10,6 +10,7 @@ param($ParentDir = "$PWD")
try {
"Fetching updates for Git repositories under $ParentDir ..."
$StartTime = get-date
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
set-location $ParentDir
@ -29,7 +30,9 @@ try {
$Count++
}
write-host -foregroundColor green "OK - fetched updates for $Count Git repositories under $ParentDir"
$StopTime = get-date
$TimeSpan = new-timeSpan -start $StartTime -end $StopTime
write-host -foregroundColor green "OK - fetched updates for $Count Git repositories under $ParentDir in $($TimeSpan.seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -10,6 +10,7 @@ param($ParentDir = "$PWD")
try {
"Pulling updates for Git repositories under $ParentDir ..."
$StartTime = get-date
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
set-location "$ParentDir"
@ -29,7 +30,10 @@ try {
set-location ..
$Count++
}
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir"
$StopTime = get-date
$TimeSpan = new-timeSpan -start $StartTime -end $StopTime
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir in $($TimeSpan.seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"