2023-10-31 13:03:45 +01:00
|
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.SYNOPSIS
|
2023-03-28 11:24:49 +02:00
|
|
|
|
Explains an abbreviation
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.DESCRIPTION
|
2023-08-18 19:07:48 +02:00
|
|
|
|
This PowerShell script queries the meaning of the given abbreviation and prints it.
|
2022-12-21 08:14:30 +01:00
|
|
|
|
.PARAMETER abbr
|
2023-08-18 19:07:48 +02:00
|
|
|
|
Specifies the abbreviation to query
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.EXAMPLE
|
2023-08-18 19:07:48 +02:00
|
|
|
|
PS> ./what-is VTOL
|
2023-10-18 17:22:03 +02:00
|
|
|
|
💡 VTOL in aviation refers to Vertical Take-Off and Landing
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2022-01-30 10:49:30 +01:00
|
|
|
|
.NOTES
|
2022-09-06 21:42:04 +02:00
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-04-27 15:54:52 +02:00
|
|
|
|
#>
|
|
|
|
|
|
2022-12-21 08:14:30 +01:00
|
|
|
|
param([string]$abbr = "")
|
2021-11-28 11:57:49 +01:00
|
|
|
|
|
2021-04-27 15:54:52 +02:00
|
|
|
|
try {
|
2023-08-18 19:07:48 +02:00
|
|
|
|
if ($abbr -eq "" ) { $abbr = Read-Host "Enter the abbreviation to query" }
|
2023-10-31 11:25:11 +01:00
|
|
|
|
$files = (Get-ChildItem "$PSScriptRoot/../data/abbr/*.csv")
|
2023-08-18 19:07:48 +02:00
|
|
|
|
$basename = ""
|
|
|
|
|
foreach($file in $files) {
|
|
|
|
|
$table = Import-CSV "$file"
|
|
|
|
|
foreach($row in $table) {
|
|
|
|
|
if ($row.ABBR -ne $abbr) { continue }
|
|
|
|
|
$basename = (Get-Item "$file").Basename -Replace "_"," "
|
2023-10-18 17:22:03 +02:00
|
|
|
|
"💡 $($row.ABBR) in $basename refers to $($row.MEANING)"
|
2021-04-27 15:54:52 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-19 11:36:31 +02:00
|
|
|
|
if ($basename -eq "") { "🤷 Sorry, no '$abbr' entry found. Use <Ctrl> <Click> to google it: https://www.google.com/search?q=abbreviation+$abbr" }
|
2021-09-27 10:09:45 +02:00
|
|
|
|
exit 0 # success
|
2021-04-27 15:54:52 +02:00
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-04-27 15:54:52 +02:00
|
|
|
|
exit 1
|
2023-02-17 14:44:58 +01:00
|
|
|
|
}
|