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