Added update-repos.ps1

This commit is contained in:
Markus Fleschutz 2021-01-20 16:11:38 +01:00
parent 4bc3339db9
commit 15a98fd9d1
5 changed files with 50 additions and 6 deletions

11
Data/repos.csv Normal file
View File

@ -0,0 +1,11 @@
URL,Directory
"https://github.com/commonmark/cmark", "cmark"
"https://github.com/elastic/elasticsearch", "elasticsearch"
"https://github.com/opencv/opencv", "opencv"
"https://github.com/openzfs/zfs", "zfs"
"https://github.com/synesthesiam/voice2json", "voice2json"
"https://github.com/fleschutz/CWTS", "CWTS"
"https://github.com/fleschutz/PowerShell", "PowerShell"
"https://github.com/fleschutz/LSS", "LSS"
"https://github.com/fleschutz/eventdriven", "eventdriven"
"https://github.com/fleschutz/base256unicode", "base256unicode"
1 URL Directory
2 https://github.com/commonmark/cmark cmark
3 https://github.com/elastic/elasticsearch elasticsearch
4 https://github.com/opencv/opencv opencv
5 https://github.com/openzfs/zfs zfs
6 https://github.com/synesthesiam/voice2json voice2json
7 https://github.com/fleschutz/CWTS CWTS
8 https://github.com/fleschutz/PowerShell PowerShell
9 https://github.com/fleschutz/LSS LSS
10 https://github.com/fleschutz/eventdriven eventdriven
11 https://github.com/fleschutz/base256unicode base256unicode

View File

@ -85,6 +85,7 @@ turn-volume-up.ps1, turns the audio volume up (+10% by default)
turn-volume-down.ps1, turns the audio volume down (-10% by default)
txt2wav.ps1, converts text into a audio .WAV file
unmute-audio.ps1, unmutes audio
update-repos.ps1, updates all Git repositories under the current directory
voice-control.ps1, executes the PowerShell scripts by voice
weather.ps1, prints the current weather forecast
weather-alert.ps1, checks the current weather for critical values

1 Filename Description
85 turn-volume-down.ps1 turns the audio volume down (-10% by default)
86 txt2wav.ps1 converts text into a audio .WAV file
87 unmute-audio.ps1 unmutes audio
88 update-repos.ps1 updates all Git repositories under the current directory
89 voice-control.ps1 executes the PowerShell scripts by voice
90 weather.ps1 prints the current weather forecast
91 weather-alert.ps1 checks the current weather for critical values

View File

@ -93,6 +93,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [turn-volume-down.ps1](Scripts/turn-volume-down.ps1) - turns the audio volume down (-10% by default)
* [txt2wav.ps1](Scripts/txt2wav.ps1) - converts text into a audio .WAV file
* [unmute-audio.ps1](Scripts/unmute-audio.ps1) - unmutes audio
* [update-repos.ps1](Scripts/update-repos.ps1) - updates all Git repositories under the current directory
* [voice-control.ps1](Scripts/voice-control.ps1) - executes the PowerShell scripts by voice
* [weather.ps1](Scripts/weather.ps1) - prints the current weather forecast
* [weather-alert.ps1](Scripts/weather-alert.ps1) - checks the current weather for critical values

View File

@ -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
View 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
}