mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-08 20:54:38 +02:00
Merge branch 'master' of github.com:fleschutz/PowerShell
This commit is contained in:
@ -27,7 +27,7 @@ try {
|
||||
|
||||
$Table = import-csv "$PSScriptRoot/../Data/git-repos.csv"
|
||||
$NumEntries = $Table.count
|
||||
"Found $NumEntries entries in database table Data/git-repos.csv."
|
||||
"Found $NumEntries entries in Data/git-repos.csv."
|
||||
|
||||
[int]$Step = 0
|
||||
[int]$Cloned = 0
|
||||
@ -40,16 +40,16 @@ try {
|
||||
$Step++
|
||||
|
||||
if (test-path "$FolderPath/$FolderName" -pathType container) {
|
||||
"⏳ Step $Step/$($NumEntries): Skipping 📂$($FolderName) (exists already)..."
|
||||
"⏳ Step $Step/$($NumEntries) - Skipping 📂$($FolderName) (exists already)..."
|
||||
$Skipped++
|
||||
continue
|
||||
}
|
||||
if ($Full -eq "yes") {
|
||||
"⏳ Step $Step/$($NumEntries): Cloning 📂$($FolderName) ($Branch branch with full history)..."
|
||||
"⏳ Step $Step/$($NumEntries) - Cloning into 📂$($FolderName) ($Branch branch with full history)..."
|
||||
& git clone --branch "$Branch" --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
|
||||
} else {
|
||||
"⏳ Step $Step/$($NumEntries): Cloning 📂$FolderName ($Branch branch only)..."
|
||||
"⏳ Step $Step/$($NumEntries) - Cloning into 📂$FolderName ($Branch branch only)..."
|
||||
& git clone --branch "$Branch" --single-branch --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
|
||||
}
|
||||
@ -65,4 +65,4 @@ try {
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
@ -6,27 +6,25 @@
|
||||
.PARAMETER RSS_URL
|
||||
Specifies the URL to the RSS feed
|
||||
.PARAMETER MaxCount
|
||||
Specifies the number of news to list
|
||||
Specifies the number of lines to list (20 by default)
|
||||
.EXAMPLE
|
||||
PS> ./list-news
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$RSS_URL = "https://yahoo.com/news/rss/world", [int]$MaxCount = 20)
|
||||
|
||||
try {
|
||||
[xml]$Content = (invoke-webRequest -uri $RSS_URL -useBasicParsing).Content
|
||||
"`n🌍 $($Content.rss.channel.title) 🌏"
|
||||
|
||||
[int]$Count = 0
|
||||
[xml]$Content = (Invoke-WebRequest -URI $RSS_URL -useBasicParsing).Content
|
||||
[int]$Count = 1
|
||||
foreach ($item in $Content.rss.channel.item) {
|
||||
"→ $($item.title)"
|
||||
$Count++
|
||||
if ($Count -eq $MaxCount) { break }
|
||||
if ($Count++ -eq $MaxCount) { break }
|
||||
}
|
||||
" Source: 🌍 $($Content.rss.channel.title) 🌍"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Reference in New Issue
Block a user