mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
Improve clone-repos.ps1
This commit is contained in:
@ -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" }
|
||||
""
|
||||
}
|
||||
|
Reference in New Issue
Block a user