mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-27 12:18:43 +02:00
Updated clone-repos.ps1
This commit is contained in:
parent
8275603fdf
commit
bbe8885cf5
@ -8,7 +8,7 @@
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./clone-repos C:\MyRepos
|
PS> ./clone-repos C:\MyRepos
|
||||||
...
|
...
|
||||||
✔️ Cloned 29 of 29 Git repos into 📂MyRepos in 123 sec
|
✔️ Cloned 29 additional Git repos into 📂MyRepos in 123s.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -45,22 +45,22 @@ try {
|
|||||||
$step++
|
$step++
|
||||||
|
|
||||||
if (Test-Path "$targetDir/$folderName" -pathType container) {
|
if (Test-Path "$targetDir/$folderName" -pathType container) {
|
||||||
"⏳ ($step/$($total + 4)) Skipping existing 📂$folderName (a $category)..."
|
"⏳ ($step/$($total + 3)) Skipping existing $category 📂$folderName..."
|
||||||
$skipped++
|
$skipped++
|
||||||
} elseif ($shallow -eq "yes") {
|
} elseif ($shallow -eq "yes") {
|
||||||
"⏳ ($step/$($total + 4)) Cloning into 📂$folderName (a $category, $branch branch, shallow)..."
|
"⏳ ($step/$($total + 3)) Cloning into 📂$folderName (a $category, $branch branch, shallow)..."
|
||||||
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
|
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||||
$cloned++
|
$cloned++
|
||||||
} else {
|
} else {
|
||||||
"⏳ ($step/$($total + 4)) Cloning into 📂$folderName (a $category, $branch branch, full history)..."
|
"⏳ ($step/$($total + 3)) Cloning into 📂$folderName (a $category, $branch branch, full history)..."
|
||||||
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
|
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||||
$clone++
|
$clone++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Cloned $cloned of $total Git repos into 📂$targetDirName in $elapsed sec"
|
"✔️ Cloned $cloned additional Git repos into 📂$targetDirName in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user