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