mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-23 14:18:38 +01:00
Add max-count to list-news.ps1
This commit is contained in:
parent
6406e4360b
commit
c58b33b7d8
@ -1,11 +1,11 @@
|
||||
<#
|
||||
.SYNTAX list-news.ps1 [<RSS-URL>]
|
||||
.SYNTAX list-news.ps1 [<RSS-URL>] [<max-count>]
|
||||
.DESCRIPTION lists the latest news
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($RSS_URL = "https://yahoo.com/news/rss/world")
|
||||
param($RSS_URL = "https://yahoo.com/news/rss/world", [int]$MaxCount = 20)
|
||||
|
||||
try {
|
||||
[xml]$Content = (invoke-webRequest -URI $RSS_URL).Content
|
||||
@ -15,7 +15,7 @@ try {
|
||||
foreach ($item in $Content.rss.channel.item) {
|
||||
"→ $($item.title)"
|
||||
$Count++
|
||||
if ($Count -eq 26) { break }
|
||||
if ($Count -eq $MaxCount) { break }
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user