mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-23 06:08:36 +01:00
Improve the output
This commit is contained in:
parent
e2188fa160
commit
0f9dcffc68
@ -8,24 +8,21 @@
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
$RepoDir = resolve-path "$RepoDir"
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
"⏳ Fetching updates for Git repository 📂$RepoDir ..."
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
"⏳ Fetching updates for Git repository 📂$RepoDirName ..."
|
||||
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
& git fetch --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") {
|
||||
write-warning "Retrying once ..."
|
||||
start-sleep -milliseconds 1000
|
||||
& git fetch --all --recurse-submodules --jobs=1
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed (twice)" }
|
||||
}
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
|
||||
"✔️ fetched Git repository 📂$RepoDirName"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -29,10 +29,11 @@ try {
|
||||
$Count++
|
||||
}
|
||||
|
||||
$ParentDirName = (get-item "$ParentDir").Name
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ fetched updates for $Count Git repositories at 📂$ParentDir in $Elapsed sec."
|
||||
"✔️ fetched updates for $Count Git repositories at 📂$ParentDirName in $Elapsed sec."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -8,11 +8,10 @@
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
$RepoDir = resolve-path "$RepoDir"
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
"⏳ Pulling updates for Git repository 📂$RepoDirName ..."
|
||||
|
||||
$Null = (git --version)
|
||||
@ -24,6 +23,6 @@ try {
|
||||
"✔️ updated Git repository 📂$RepoDirName"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -29,10 +29,11 @@ try {
|
||||
$Count++
|
||||
}
|
||||
|
||||
$ParentDirName = (get-item "$ParentDir").Name
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ pulled updates for $Count Git repositories at 📂$ParentDir in $Elapsed sec."
|
||||
"✔️ pulled updates for $Count Git repositories at 📂$ParentDirName in $Elapsed sec."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user