Update clone-repos.ps1

This commit is contained in:
Markus Fleschutz 2023-04-01 21:44:57 +02:00
parent 84dc11a7fb
commit 43a92a1432

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Clones Git repositories Clones popular repos
.DESCRIPTION .DESCRIPTION
This PowerShell script clones popular Git repositories into a target directory. This PowerShell script clones popular Git repositories into a target directory.
.PARAMETER targetDir .PARAMETER targetDir
@ -49,11 +49,11 @@ try {
continue continue
} }
if ($Full -eq "yes") { if ($Full -eq "yes") {
"⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$($FolderName) ($Branch branch with full history)..." "⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Branch branch with 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" }
} else { } else {
"⏳ ($Step/$($NumEntries + 4)) Cloning $Branch branch into 📂$FolderName..." "⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Branch branch only)..."
& 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" }
} }
@ -61,9 +61,9 @@ try {
} }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
if ($Cloned -eq 1) { if ($Cloned -eq 1) {
"✔️ 1 repository cloned into 📂$TargetDirName in $Elapsed sec ($Skipped skipped)." "✔️ 1 repo cloned into 📂$TargetDirName in $Elapsed sec ($Skipped skipped)"
} else { } else {
"✔️ $Cloned repositories cloned into 📂$TargetDirName in $Elapsed sec ($Skipped skipped)." "✔️ $Cloned repos cloned into 📂$TargetDirName in $Elapsed sec ($Skipped skipped)"
} }
exit 0 # success exit 0 # success
} catch { } catch {