PowerShell/Scripts/clone-repos.ps1

27 lines
574 B
PowerShell
Raw Normal View History

2020-12-01 12:24:56 +01:00
#!/snap/bin/powershell
2020-12-29 15:14:21 +01:00
<#
.SYNTAX ./clone-repos.ps1
.DESCRIPTION clones well-known Git repositories into the current directory.
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
2020-12-01 12:24:56 +01:00
2021-01-20 16:11:38 +01:00
$PathToRepo = "$PSScriptRoot/.."
2020-12-01 12:24:56 +01:00
2020-12-09 10:30:55 +01:00
try {
2021-01-20 16:11:38 +01:00
$Table = import-csv "$PathToRepo/Data/repos.csv"
foreach($Row in $Table) {
$URL = $Row.URL
write-output ""
write-output "Cloning $URL..."
git clone $URL
2020-12-01 12:24:56 +01:00
}
2020-12-25 11:30:43 +01:00
write-output "Done."
2020-12-09 10:30:55 +01:00
exit 0
} catch {
2020-12-25 11:30:43 +01:00
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
2020-12-09 10:30:55 +01:00
exit 1
}