mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Added update-repos.ps1
This commit is contained in:
parent
4bc3339db9
commit
15a98fd9d1
11
Data/repos.csv
Normal file
11
Data/repos.csv
Normal 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"
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user