2021-09-27 10:38:12 +02:00
|
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.SYNOPSIS
|
2021-10-16 16:50:10 +02:00
|
|
|
|
Prints a description of an abbreviation
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.DESCRIPTION
|
2022-12-21 08:14:30 +01:00
|
|
|
|
This PowerShell script queries and prints a description of the given abbreviation.
|
|
|
|
|
.PARAMETER abbr
|
|
|
|
|
Specifies the abbreviation to look for
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.EXAMPLE
|
2021-11-28 11:57:49 +01:00
|
|
|
|
PS> ./what-is IAS
|
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 {
|
2022-12-21 08:14:30 +01:00
|
|
|
|
if ($abbr -eq "" ) { $abbr = Read-Host "Enter the abbreviation" }
|
2021-04-29 20:19:07 +02:00
|
|
|
|
|
2022-12-21 08:14:30 +01:00
|
|
|
|
$Missing = $true
|
|
|
|
|
$Files = (Get-ChildItem "$PSScriptRoot/../Data/Abbr/*.csv")
|
2021-05-20 11:30:01 +02:00
|
|
|
|
foreach ($File in $Files) {
|
2022-12-21 08:14:30 +01:00
|
|
|
|
$Table = Import-CSV "$File"
|
2021-05-20 11:30:01 +02:00
|
|
|
|
foreach($Row in $Table) {
|
2022-12-21 08:14:30 +01:00
|
|
|
|
if ($Row.Abbr -eq $abbr) {
|
|
|
|
|
$Basename = (Get-Item "$File").Basename
|
|
|
|
|
"🔎 In $Basename $($Row.Abbr) may refer to $($Row.Term)"
|
|
|
|
|
$Missing = $false
|
2021-05-20 11:30:01 +02:00
|
|
|
|
}
|
2021-04-27 15:54:52 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-21 08:14:30 +01:00
|
|
|
|
if ($Missing) { "Sorry, '$abbr' is missing in the database." }
|
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
|
2022-12-21 08:14:30 +01:00
|
|
|
|
}
|