mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Add chikitpao/CSS repository and update clone-repos.ps1
This commit is contained in:
parent
8693c29dc1
commit
039583ebfe
@ -1,10 +1,11 @@
|
||||
Category,FolderName, Branch, Full, URL
|
||||
GROUP, FOLDERNAME, BRANCH, FULL, URL
|
||||
Dev, base256unicode, main, no, "git@github.com:fleschutz/base256unicode"
|
||||
Dev, bazel, master, no, "git@github.com:bazelbuild/bazel"
|
||||
Dev, cmake, master, no, "git@github.com:Kitware/CMake"
|
||||
Fun, cmatrix, master, no, "git@github.com:abishekvashok/cmatrix"
|
||||
Tool, cmark, master, no, "git@github.com:commonmark/cmark"
|
||||
Dev, CWTS, master, no, "git@github.com:fleschutz/CWTS"
|
||||
Math, CSS, main, no, "git@github.com:chikitpao/CSS"
|
||||
Tool, elasticsearch, main, no, "git@github.com:elastic/elasticsearch"
|
||||
Tool, go-ipfs, master, no, "git@github.com:ipfs/go-ipfs"
|
||||
Tool, grafana, main, no, "git@github.com:grafana/grafana"
|
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
@ -4,7 +4,7 @@
|
||||
.DESCRIPTION
|
||||
This PowerShell script clones well-known Git repositories into a folder.
|
||||
.PARAMETER folder
|
||||
Specifies the target folder
|
||||
Specifies the target folder (default is current working directory)
|
||||
.EXAMPLE
|
||||
PS> ./clone-repos C:\Repos
|
||||
.LINK
|
||||
@ -18,17 +18,17 @@ param([string]$FolderPath = "$PWD")
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ Step 1 - Searching for Git executable..."
|
||||
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" }
|
||||
|
||||
"⏳ Step 2 - Loading database table in Data/git-repos.csv..."
|
||||
Write-Host "⏳ (2) Loading database table from Data/git-repos.csv... " -noNewline
|
||||
$Table = Import-CSV "$PSScriptRoot/../Data/git-repos.csv"
|
||||
$NumEntries = $Table.count
|
||||
"Found $NumEntries entries."
|
||||
Write-Host "$NumEntries entries found"
|
||||
|
||||
$ParentFolderName = (Get-Item "$FolderPath").Name
|
||||
"⏳ Step 3 - Checking folder 📂$ParentFolderName..."
|
||||
"⏳ (3) Checking target folder 📂$ParentFolderName..."
|
||||
if (-not(Test-Path "$FolderPath" -pathType container)) { throw "Can't access directory: $FolderPath" }
|
||||
|
||||
|
||||
@ -36,23 +36,24 @@ try {
|
||||
[int]$Cloned = 0
|
||||
[int]$Skipped = 0
|
||||
foreach($Row in $Table) {
|
||||
[string]$FolderName = $Row.FolderName
|
||||
[string]$Branch = $Row.Branch
|
||||
[string]$Full = $Row.Full
|
||||
[string]$Group = $Row.GROUP
|
||||
[string]$FolderName = $Row.FOLDERNAME
|
||||
[string]$Branch = $Row.BRANCH
|
||||
[string]$Full = $Row.FULL
|
||||
[string]$URL = $Row.URL
|
||||
$Step++
|
||||
|
||||
if (test-path "$FolderPath/$FolderName" -pathType container) {
|
||||
"⏳ Step $Step/$($NumEntries + 4) - Skipping 📂$($FolderName) (exists already)..."
|
||||
if (Test-Path "$FolderPath/$FolderName" -pathType container) {
|
||||
"⏳ ($Step/$($NumEntries + 4)) Skipping 📂$($FolderName), it exists already..."
|
||||
$Skipped++
|
||||
continue
|
||||
}
|
||||
if ($Full -eq "yes") {
|
||||
"⏳ Step $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" "$FolderPath/$FolderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
|
||||
} else {
|
||||
"⏳ Step $Step/$($NumEntries + 4) - Cloning into 📂$FolderName ($Branch branch only)..."
|
||||
"⏳ ($Step/$($NumEntries + 4)) Cloning $Branch branch into 📂$FolderName..."
|
||||
& git clone --branch "$Branch" --single-branch --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
|
||||
}
|
||||
@ -60,9 +61,9 @@ try {
|
||||
}
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
if ($Cloned -eq 1) {
|
||||
"✔️ $Cloned repo cloned into 📂$ParentFolderName ($Skipped skipped) in $Elapsed sec"
|
||||
"✔️ 1 Git repository cloned into 📂$ParentFolderName in $Elapsed sec ($Skipped skipped)."
|
||||
} else {
|
||||
"✔️ $Cloned repos cloned into 📂$ParentFolderName ($Skipped skipped) in $Elapsed sec"
|
||||
"✔️ $Cloned Git repos cloned into 📂$ParentFolderName in $Elapsed sec ($Skipped skipped)."
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user