mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-08 22:10:14 +01:00
Improve clone-repos.ps1
This commit is contained in:
parent
f8eaf73614
commit
bb5e5d4b82
@ -6,6 +6,7 @@ URL,Directory
|
|||||||
"https://github.com/fleschutz/LSS", "LSS"
|
"https://github.com/fleschutz/LSS", "LSS"
|
||||||
"https://github.com/fleschutz/base256unicode", "base256unicode"
|
"https://github.com/fleschutz/base256unicode", "base256unicode"
|
||||||
"https://github.com/grafana/grafana", "grafana"
|
"https://github.com/grafana/grafana", "grafana"
|
||||||
|
"https://github.com/llvm/llvm-project", "llvm"
|
||||||
"https://github.com/smartmontools/smartmontools", "smartmontools"
|
"https://github.com/smartmontools/smartmontools", "smartmontools"
|
||||||
"https://github.com/synesthesiam/voice2json", "voice2json"
|
"https://github.com/synesthesiam/voice2json", "voice2json"
|
||||||
"https://github.com/TinyCC/tinycc", "tinycc"
|
"https://github.com/TinyCC/tinycc", "tinycc"
|
|
@ -9,22 +9,22 @@
|
|||||||
param($TargetDir = "$PWD")
|
param($TargetDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (-not(test-path "$TargetDir" -pathType container)) { throw "Can't access directory: $TargetDir" }
|
||||||
|
|
||||||
$Null = (git --version)
|
$Null = (git --version)
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
$PathToRepo = "$PSScriptRoot/.."
|
$Table = import-csv "$PSScriptRoot/../Data/git-repositories.csv"
|
||||||
$Table = import-csv "$PathToRepo/Data/repos.csv"
|
|
||||||
|
|
||||||
set-location $TargetDir
|
|
||||||
foreach($Row in $Table) {
|
foreach($Row in $Table) {
|
||||||
$URL = $Row.URL
|
$URL = $Row.URL
|
||||||
$Directory = $Row.Directory
|
$Directory = $Row.Directory
|
||||||
if (Test-Path $Directory) {
|
if (Test-Path "$TargetDir/$Directory") {
|
||||||
"Skipping existing $Directory..."
|
"Skipping existing $Directory..."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
"⏳ Cloning $URL..."
|
"⏳ Cloning $URL..."
|
||||||
& git clone --recurse-submodules $URL
|
& git clone --recurse-submodules "$URL" "$TargetDir/$Directory"
|
||||||
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
|
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user