Update clone-repos.ps1

This commit is contained in:
Markus Fleschutz 2023-04-28 07:49:54 +02:00
parent f1fe5db242
commit a4674ed7bb
2 changed files with 35 additions and 40 deletions

View File

@ -1,29 +1,29 @@
GROUP, FOLDERNAME, BRANCH, FULL, URL FOLDERNAME, CATEGORY, BRANCH, FULL, URL
Dev, base256unicode, main, no, "git@github.com:fleschutz/base256unicode.git" base256unicode, dev tool, main, no, "git@github.com:fleschutz/base256unicode.git"
Dev, bazel, master, no, "git@github.com:bazelbuild/bazel.git" bazel, build tool, master, no, "git@github.com:bazelbuild/bazel.git"
Dev, cmake, master, no, "git@github.com:Kitware/CMake.git" cmake, build tool, master, no, "git@github.com:Kitware/CMake.git"
Fun, cmatrix, master, no, "git@github.com:abishekvashok/cmatrix.git" cmatrix, CLI fun, master, no, "git@github.com:abishekvashok/cmatrix.git"
Tool, cmark, master, no, "git@github.com:commonmark/cmark.git" cmark, tool, master, no, "git@github.com:commonmark/cmark.git"
Dev, CWTS, master, no, "git@github.com:fleschutz/CWTS.git" CWTS, dev tool, master, no, "git@github.com:fleschutz/CWTS.git"
Math, CSS, main, no, "git@github.com:chikitpao/CSS.git" CSS, math tool, main, no, "git@github.com:chikitpao/CSS.git"
Tool, elasticsearch, main, no, "git@github.com:elastic/elasticsearch.git" elasticsearch, search tool, main, no, "git@github.com:elastic/elasticsearch.git"
Tool, go-ipfs, master, no, "git@github.com:ipfs/go-ipfs.git" go-ipfs, tool, master, no, "git@github.com:ipfs/go-ipfs.git"
Tool, grafana, main, no, "git@github.com:grafana/grafana.git" grafana, visualization, main, no, "git@github.com:grafana/grafana.git"
Tool, jhead, master, no, "git@github.com:Matthias-Wandel/jhead" jhead, EXIF tool, master, no, "git@github.com:Matthias-Wandel/jhead"
Tool, leon, master, no, "git@github.com:leon-ai/leon.git" leon, personal assistant, master, no, "git@github.com:leon-ai/leon.git"
Dev, llvm, master, no, "git@github.com:llvm/llvm-project.git" llvm, compiler, master, no, "git@github.com:llvm/llvm-project.git"
Math, LSS, master, no, "git@github.com:fleschutz/LSS.git" LSS, math, master, no, "git@github.com:fleschutz/LSS.git"
Dev, ninja, master, no, "git@github.com:ninja-build/ninja.git" ninja, build tool, master, no, "git@github.com:ninja-build/ninja.git"
Libs, opencv, master, no, "git@github.com:opencv/opencv.git" opencv, lib, master, no, "git@github.com:opencv/opencv.git"
Tool, operating-systems, main, no, "git@github.com:fleschutz/operating-systems.git" operating-systems, collection, main, no, "git@github.com:fleschutz/operating-systems.git"
Shell, PowerShell, master, no, "git@github.com:fleschutz/PowerShell.git" PowerShell, collection, master, no, "git@github.com:fleschutz/PowerShell.git"
Shell, pwsh, master, no, "git@github.com:PowerShell/PowerShell.git" pwsh, shell, master, no, "git@github.com:PowerShell/PowerShell.git"
Dev, protobuf, main, no, "git@github.com:protocolbuffers/protobuf.git" protobuf, dev, main, no, "git@github.com:protocolbuffers/protobuf.git"
Dev, rust, master, no, "git@github.com:rust-lang/rust.git" rust, compiler, master, no, "git@github.com:rust-lang/rust.git"
Tool, smartmontools, master, no, "git@github.com:smartmontools/smartmontools.git" smartmontools, SSD/HDD tool, master, no, "git@github.com:smartmontools/smartmontools.git"
Tool, talk2windows, main, no, "git@github.com:fleschutz/talk2windows.git" talk2windows, tool, main, no, "git@github.com:fleschutz/talk2windows.git"
Tool, tensorflow, master, no, "git@github.com:tensorflow/tensorflow.git" tensorflow, tool, master, no, "git@github.com:tensorflow/tensorflow.git"
Tool, terminal, main, no, "git@github.com:microsoft/terminal.git" terminal, desktop tool, main, no, "git@github.com:microsoft/terminal.git"
Dev, tinycc, mob, no, "git@github.com:TinyCC/tinycc.git" tinycc, compiler, mob, no, "git@github.com:TinyCC/tinycc.git"
Tool, voice2json, master, no, "git@github.com:synesthesiam/voice2json.git" voice2json, tool, master, no, "git@github.com:synesthesiam/voice2json.git"
Tool, zfs, master, no, "git@github.com:openzfs/zfs.git" zfs, tool, master, no, "git@github.com:openzfs/zfs.git"

1 GROUP FOLDERNAME CATEGORY BRANCH FULL URL
2 Dev base256unicode dev tool main no git@github.com:fleschutz/base256unicode.git
3 Dev bazel build tool master no git@github.com:bazelbuild/bazel.git
4 Dev cmake build tool master no git@github.com:Kitware/CMake.git
5 Fun cmatrix CLI fun master no git@github.com:abishekvashok/cmatrix.git
6 Tool cmark tool master no git@github.com:commonmark/cmark.git
7 Dev CWTS dev tool master no git@github.com:fleschutz/CWTS.git
8 Math CSS math tool main no git@github.com:chikitpao/CSS.git
9 Tool elasticsearch search tool main no git@github.com:elastic/elasticsearch.git
10 Tool go-ipfs tool master no git@github.com:ipfs/go-ipfs.git
11 Tool grafana visualization main no git@github.com:grafana/grafana.git
12 Tool jhead EXIF tool master no git@github.com:Matthias-Wandel/jhead
13 Tool leon personal assistant master no git@github.com:leon-ai/leon.git
14 Dev llvm compiler master no git@github.com:llvm/llvm-project.git
15 Math LSS math master no git@github.com:fleschutz/LSS.git
16 Dev ninja build tool master no git@github.com:ninja-build/ninja.git
17 Libs opencv lib master no git@github.com:opencv/opencv.git
18 Tool operating-systems collection main no git@github.com:fleschutz/operating-systems.git
19 Shell PowerShell collection master no git@github.com:fleschutz/PowerShell.git
20 Shell pwsh shell master no git@github.com:PowerShell/PowerShell.git
21 Dev protobuf dev main no git@github.com:protocolbuffers/protobuf.git
22 Dev rust compiler master no git@github.com:rust-lang/rust.git
23 Tool smartmontools SSD/HDD tool master no git@github.com:smartmontools/smartmontools.git
24 Tool talk2windows tool main no git@github.com:fleschutz/talk2windows.git
25 Tool tensorflow tool master no git@github.com:tensorflow/tensorflow.git
26 Tool terminal desktop tool main no git@github.com:microsoft/terminal.git
27 Dev tinycc compiler mob no git@github.com:TinyCC/tinycc.git
28 Tool voice2json tool master no git@github.com:synesthesiam/voice2json.git
29 Tool zfs tool master no git@github.com:openzfs/zfs.git

View File

@ -4,7 +4,7 @@
.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
Specifies the target directory (current working directory by default) Specifies the file path to the target directory (current working directory by default)
.EXAMPLE .EXAMPLE
PS> ./clone-repos C:\Repos PS> ./clone-repos C:\Repos
.LINK .LINK
@ -31,40 +31,35 @@ try {
Write-Host "⏳ (3) Checking target folder... 📂$TargetDirName" Write-Host "⏳ (3) Checking target folder... 📂$TargetDirName"
if (-not(Test-Path "$TargetDir" -pathType container)) { throw "Can't access directory: $TargetDir" } if (-not(Test-Path "$TargetDir" -pathType container)) { throw "Can't access directory: $TargetDir" }
[int]$Step = 3 [int]$Step = 3
[int]$Cloned = 0 [int]$Cloned = 0
[int]$Skipped = 0 [int]$Skipped = 0
foreach($Row in $Table) { foreach($Row in $Table) {
[string]$Group = $Row.GROUP
[string]$FolderName = $Row.FOLDERNAME [string]$FolderName = $Row.FOLDERNAME
[string]$Category = $Row.CATEGORY
[string]$Branch = $Row.BRANCH [string]$Branch = $Row.BRANCH
[string]$Full = $Row.FULL [string]$Full = $Row.FULL
[string]$URL = $Row.URL [string]$URL = $Row.URL
$Step++ $Step++
if (Test-Path "$TargetDir/$FolderName" -pathType container) { if (Test-Path "$TargetDir/$FolderName" -pathType container) {
"⏳ ($Step/$($NumEntries + 4)) Skipping existing 📂$($FolderName)..." "⏳ ($Step/$($NumEntries + 4)) Skipping existing 📂$FolderName ($Category)..."
$Skipped++ $Skipped++
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 ($Category) - $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 into 📂$FolderName ($Branch branch only)..." "⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Category) - $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" }
} }
$Cloned++ $Cloned++
} }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
if ($Cloned -eq 1) { "✔️ cloned $Cloned of $NumEntries Git repos into folder 📂$TargetDirName in $Elapsed sec"
"✔️ 1 repo cloned into 📂$TargetDirName in $Elapsed sec ($Skipped skipped)"
} else {
"✔️ $Cloned repos cloned into 📂$TargetDirName in $Elapsed sec ($Skipped skipped)"
}
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"