mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-08 20:54:38 +02:00
Added update-repos.ps1
This commit is contained in:
@ -6,14 +6,16 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$Repos = "https://github.com/commonmark/cmark", "https://github.com/opencv/opencv", "https://github.com/openzfs/zfs", "https://github.com/synesthesiam/voice2json", "https://github.com/fleschutz/CWTS", "https://github.com/fleschutz/cubesum", "https://github.com/fleschutz/PowerShell","https://github.com/fleschutz/CWTS", "https://github.com/fleschutz/eventdriven"
|
||||
$PathToRepo = "$PSScriptRoot/.."
|
||||
|
||||
try {
|
||||
foreach ($Repo in $Repos) {
|
||||
$Answer = read-host "Do you want to clone $Repo (y/n)"
|
||||
if ($Answer -eq "y") {
|
||||
git clone $Repo
|
||||
}
|
||||
$Table = import-csv "$PathToRepo/Data/repos.csv"
|
||||
|
||||
foreach($Row in $Table) {
|
||||
$URL = $Row.URL
|
||||
write-output ""
|
||||
write-output "Cloning $URL..."
|
||||
git clone $URL
|
||||
}
|
||||
|
||||
write-output "Done."
|
||||
|
29
Scripts/update-repos.ps1
Executable file
29
Scripts/update-repos.ps1
Executable file
@ -0,0 +1,29 @@
|
||||
#!/snap/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./update-repos.ps1 [<directory>]
|
||||
.DESCRIPTION updates all Git repositories under the current directory
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Directory = "")
|
||||
|
||||
try {
|
||||
if ($Directory -eq "") {
|
||||
$Directory = "$PWD"
|
||||
}
|
||||
$Items = get-childItem -path $Directory
|
||||
foreach ($Item in $Items) {
|
||||
if ($Item.Mode -eq "d-----") {
|
||||
$Filename = $Item.Name
|
||||
set-location $Filename
|
||||
git pull
|
||||
set-location ..
|
||||
}
|
||||
}
|
||||
write-output "Done."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Reference in New Issue
Block a user