Updated the Markdown manuals

This commit is contained in:
Markus Fleschutz
2024-05-19 10:25:56 +02:00
parent c24030c909
commit 439fbf5bfa
621 changed files with 2430 additions and 1289 deletions

View File

@ -6,10 +6,10 @@ This PowerShell script prints the geographic location of the given city.
Parameters
----------
```powershell
PS> ./locate-city.ps1 [[-City] <String>] [<CommonParameters>]
PS> ./locate-city.ps1 [[-city] <String>] [<CommonParameters>]
-City <String>
Specifies the city to look for
-city <String>
Specifies the name of the city to look for
Required? false
Position? 1
@ -25,7 +25,9 @@ PS> ./locate-city.ps1 [[-City] <String>] [<CommonParameters>]
Example
-------
```powershell
PS> ./locate-city.ps1 Paris
PS> ./locate-city.ps1 Amsterdam
* Amsterdam (United States, New York, population 21241) is at 42.9420°N, -74.1907°W
* Amsterdam (Netherlands, Noord-Holland, population 1031000) is at 52.3500°N, 4.9166°W
```
@ -45,46 +47,44 @@ Script Content
Prints the geographic location of a city
.DESCRIPTION
This PowerShell script prints the geographic location of the given city.
.PARAMETER City
Specifies the city to look for
.PARAMETER city
Specifies the name of the city to look for
.EXAMPLE
PS> ./locate-city.ps1 Paris
PS> ./locate-city.ps1 Amsterdam
* Amsterdam (United States, New York, population 21241) is at 42.9420°N, -74.1907°W
* Amsterdam (Netherlands, Noord-Holland, population 1031000) is at 52.3500°N, 4.9166°W
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$City = "")
param([string]$city = "")
try {
if ($City -eq "" ) { $City = Read-Host "Enter the city name" }
if ($city -eq "" ) { $city = Read-Host "Enter the name of the city" }
Write-Progress "Reading worldcities.csv..."
$Table = import-csv "$PSScriptRoot/../data/worldcities.csv"
Write-Progress "Reading data/worldcities.csv..."
$table = Import-CSV "$PSScriptRoot/../data/worldcities.csv"
$FoundOne = 0
foreach($Row in $Table) {
if ($Row.city -eq $City) {
$FoundOne = 1
$Country = $Row.country
$Region = $Row.admin_name
$Lat = $Row.lat
$Long = $Row.lng
$Population = $Row.population
write-host "* $City ($Country, $Region, population $Population) is at $Lat°N, $Long°W"
$foundOne = 0
foreach($row in $table) {
if ($row.city -eq $city) {
$foundOne = 1
$country = $row.country
$region = $row.admin_name
$lat = $row.lat
$long = $row.lng
$population = $row.population
Write-Host "* $city ($country, $region, population $population) is at $lat°N, $long°W"
}
}
if ($FoundOne) {
exit 0 # success
}
write-error "City $City not found"
exit 1
if (-not $foundOne) { throw "No city '$city' found in database" }
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error $($_.InvocationInfo.ScriptLineNumber): $($Error[0])."
exit 1
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of locate-city.ps1 as of 03/27/2024 17:36:29)*
*(generated by convert-ps2md.ps1 using the comment-based help of locate-city.ps1 as of 05/19/2024 10:25:23)*