diff --git a/Data/popular-repositories.csv b/Data/popular-repositories.csv index f0c6b982..455fb329 100644 --- a/Data/popular-repositories.csv +++ b/Data/popular-repositories.csv @@ -1,30 +1,30 @@ -FOLDERNAME, CATEGORY, BRANCH, SHALLOW, URL, -base256unicode, "dev tool", main, yes, "git@github.com:fleschutz/base256unicode.git", -bazel, "build tool", master, yes, "git@github.com:bazelbuild/bazel.git", -cmake, "build tool", master, yes, "git@github.com:Kitware/CMake.git", -cmatrix, "CLI fun", master, yes, "git@github.com:abishekvashok/cmatrix.git", -cmark, "Markdown tool", master, yes, "git@github.com:commonmark/cmark.git", -curl, "data transfer tool", master, yes, "https://github.com/curl/curl.git", -CWTS, "dev tool", main, yes, "git@github.com:fleschutz/CWTS.git", -elasticsearch, "search tool", main, yes, "git@github.com:elastic/elasticsearch.git", -kubo, "data transfer tool", master, yes, "git@github.com:ipfs/kubo.git", -grafana, "visualization tool", main, yes, "git@github.com:grafana/grafana.git", -jhead, "EXIF tool", master, yes, "git@github.com:Matthias-Wandel/jhead", -leon, "personal assistant", master, yes, "git@github.com:leon-ai/leon.git", -llvm, "compiler", main, yes, "git@github.com:llvm/llvm-project.git", -LSS, "math tool", main, yes, "git@github.com:fleschutz/LSS.git", -ninja, "build tool", master, yes, "git@github.com:ninja-build/ninja.git", -opencv, "lib", master, yes, "git@github.com:opencv/opencv.git", -operating-systems, "OS collection", main, yes, "git@github.com:fleschutz/operating-systems.git", -papers, "collection", main, yes, "git@github.com:fleschutz/papers.git", -PowerShell, "script collection", master, yes, "git@github.com:fleschutz/PowerShell.git", -pwsh, "shell", master, yes, "git@github.com:PowerShell/PowerShell.git", -protobuf, "dev", main, yes, "git@github.com:protocolbuffers/protobuf.git", -rust, "compiler", master, yes, "git@github.com:rust-lang/rust.git", -smartmontools, "SSD/HDD tool", master, yes, "git@github.com:smartmontools/smartmontools.git", -talk2windows, "voice tool" main, yes, "git@github.com:fleschutz/talk2windows.git", -tensorflow, "AI tool", master, yes, "git@github.com:tensorflow/tensorflow.git", -terminal, "desktop tool", main, yes, "git@github.com:microsoft/terminal.git", -tinycc, "compiler", mob, yes, "git@github.com:TinyCC/tinycc.git", -voice2json, "voice tool", master, yes, "git@github.com:synesthesiam/voice2json.git", -zfs, "filesystem tool", master, yes, "git@github.com:openzfs/zfs.git", +FOLDERNAME, CATEGORY, URL, BRANCH, SHALLOW, +base256unicode, "dev tool", "git@github.com:fleschutz/base256unicode.git", main, yes, +bazel, "build tool", "https://github.com/bazelbuild/bazel", master, yes, +cmake, "build tool", "https://github.com/Kitware/CMake", master, yes, +cmatrix, "fun tool", "https://github.com/abishekvashok/cmatrix", master, yes, +cmark, "Markdown tool", "https://github.com/commonmark/cmark", master, yes, +curl, "data transfer tool", "https://github.com/curl/curl", master, yes, +CWTS, "dev tool", "git@github.com:fleschutz/CWTS.git", main, yes, +elasticsearch, "search tool", "https://github.com/elastic/elasticsearch", main, yes, +kubo, "data transfer tool", "https://github.com/ipfs/kubo", master, yes, +grafana, "visualization tool", "https://github.com/grafana/grafana", main, yes, +jhead, "EXIF tool", "https://github.com/Matthias-Wandel/jhead", master, yes, +leon, "personal assistant", "https://github.com/leon-ai/leon", master, yes, +llvm, "compiler", "https://github.com/llvm/llvm-project", main, yes, +LSS, "math tool", "git@github.com:fleschutz/LSS.git", main, yes, +ninja, "build tool", "https://github.com/ninja-build/ninja", master, yes, +opencv, "dev lib", "https://github.com/opencv/opencv", master, yes, +operating-systems, "OS collection", "git@github.com:fleschutz/operating-systems.git", main, yes, +papers, "collection", "git@github.com:fleschutz/papers.git", main, yes, +PowerShell, "script collection", "git@github.com:fleschutz/PowerShell.git", master, yes, +pwsh, "shell", "https://github.com/PowerShell/PowerShell", master, yes, +protobuf, "dev lib", "https://github.com/protocolbuffers/protobuf", main, yes, +rust, "compiler", "https://github.com/rust-lang/rust", master, yes, +smartmontools, "SSD/HDD tool", "https://github.com/smartmontools/smartmontools", master, yes, +talk2windows, "voice tool", "git@github.com:fleschutz/talk2windows.git", main, yes, +tensorflow, "AI tool", "https://github.com/tensorflow/tensorflow", master, yes, +terminal, "desktop tool", "https://github.com/microsoft/terminal", main, yes, +tinycc, "compiler", "https://github.com/TinyCC/tinycc", mob, yes, +voice2json, "voice tool", "https://github.com/synesthesiam/voice2json", master, yes, +zfs, "filesystem tool", "https://github.com/openzfs/zfs", master, yes, diff --git a/Scripts/clone-repos.ps1 b/Scripts/clone-repos.ps1 index 3a9a0e5f..cbb4e062 100755 --- a/Scripts/clone-repos.ps1 +++ b/Scripts/clone-repos.ps1 @@ -2,69 +2,66 @@ .SYNOPSIS Clones Git repos .DESCRIPTION - This PowerShell script clones popular Git repositories into a target directory. + This PowerShell script clones popular Git repositories into a common target directory. .PARAMETER targetDir Specifies the file path to the target directory (current working directory by default) .EXAMPLE PS> ./clone-repos C:\Repos - ⏳ (1) Searching for Git executable... git version 2.41.0.windows.3 - ⏳ (2) Reading Data/popular-repositories.csv... 28 repos - ⏳ (3) Checking target folder... πŸ“‚repos - ⏳ (4/32) Cloning into πŸ“‚base256unicode (dev tool)... ... + βœ”οΈ Cloned 29 of 29 Git repos into πŸ“‚C:\Repos in 123 sec .LINK https://github.com/fleschutz/PowerShell .NOTES Author: Markus Fleschutz | License: CC0 #> -param([string]$TargetDir = "$PWD") +param([string]$targetDir = "$PWD") try { - $StopWatch = [system.diagnostics.stopwatch]::startNew() + $stopWatch = [system.diagnostics.stopwatch]::startNew() Write-Host "⏳ (1) Searching for Git executable... " -noNewline & git --version if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } Write-Host "⏳ (2) Reading Data/popular-repositories.csv... " -noNewline - $Table = Import-CSV "$PSScriptRoot/../Data/popular-repositories.csv" - $NumEntries = $Table.count - Write-Host "$NumEntries repos" + $table = Import-CSV "$PSScriptRoot/../Data/popular-repositories.csv" + $total = $table.count + Write-Host "$total repos" - $TargetDirName = (Get-Item "$TargetDir").Name - Write-Host "⏳ (3) Checking target folder... πŸ“‚$TargetDirName" - if (-not(Test-Path "$TargetDir" -pathType container)) { throw "Can't access directory: $TargetDir" } + $targetDirName = (Get-Item "$targetDir").Name + Write-Host "⏳ (3) Checking target folder... πŸ“‚$targetDirName" + if (-not(Test-Path "$targetDir" -pathType container)) { throw "Can't access directory: $targetDir" } - [int]$Step = 3 - [int]$Cloned = 0 - [int]$Skipped = 0 - foreach($Row in $Table) { - [string]$FolderName = $Row.FOLDERNAME - [string]$Category = $Row.CATEGORY - [string]$Branch = $Row.BRANCH - [string]$Shallow = $Row.SHALLOW - [string]$URL = $Row.URL - $Step++ + [int]$step = 3 + [int]$cloned = 0 + [int]$skipped = 0 + foreach($row in $table) { + [string]$folderName = $row.FOLDERNAME + [string]$category = $row.CATEGORY + [string]$URL = $row.URL + [string]$branch = $row.BRANCH + [string]$shallow = $row.SHALLOW + $step++ - if (Test-Path "$TargetDir/$FolderName" -pathType container) { - "⏳ ($Step/$($NumEntries + 4)) Skipping existing πŸ“‚$FolderName ($Category)..." - $Skipped++ + if (Test-Path "$targetDir/$folderName" -pathType container) { + "⏳ ($step/$($total + 4)) Skipping existing πŸ“‚$folderName ($category)..." + $skipped++ continue } - if ($Shallow -eq "yes") { - "⏳ ($Step/$($NumEntries + 4)) Cloning into πŸ“‚$FolderName ($Category) - $Branch branch only..." - & 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 ($shallow -eq "yes") { + "⏳ ($step/$($total + 4)) Cloning into πŸ“‚$folderName (a $category, $branch branch, shallow)..." + & 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" } } else { - "⏳ ($Step/$($NumEntries + 4)) Cloning into πŸ“‚$FolderName ($Category) - $Branch branch with full history..." - & git clone --branch "$Branch" --recurse-submodules "$URL" "$TargetDir/$FolderName" - if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" } + "⏳ ($step/$($total + 4)) Cloning into πŸ“‚$folderName (a $category, $branch branch, full history)..." + & git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName" + if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" } } - $Cloned++ + $cloned++ } - [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds - "βœ”οΈ Cloning $Cloned of $NumEntries Git repos into folder πŸ“‚$TargetDirName took $Elapsed sec" + [int]$elapsed = $stopWatch.Elapsed.TotalSeconds + "βœ”οΈ Cloned $cloned of $total Git repos into πŸ“‚$targetDirName in $Elapsed sec" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"