2024-10-01 15:24:16 +02:00
|
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.SYNOPSIS
|
2024-02-12 15:13:52 +01:00
|
|
|
|
Explains a term/abbreviation/etc.
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.DESCRIPTION
|
2024-02-12 15:13:52 +01:00
|
|
|
|
This PowerShell script queries the meaning of the given term/abbreviation/etc. and prints it.
|
|
|
|
|
.PARAMETER term
|
|
|
|
|
Specifies the term to query
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.EXAMPLE
|
2023-08-18 19:07:48 +02:00
|
|
|
|
PS> ./what-is VTOL
|
2024-06-27 12:45:47 +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
|
|
|
|
#>
|
|
|
|
|
|
2024-02-12 15:13:52 +01:00
|
|
|
|
param([string]$term = "")
|
2021-11-28 11:57:49 +01:00
|
|
|
|
|
2021-04-27 15:54:52 +02:00
|
|
|
|
try {
|
2024-02-12 15:13:52 +01:00
|
|
|
|
if ($term -eq "" ) { $term = Read-Host "Enter the term/abbreviation/etc. to query" }
|
2024-06-27 12:45:47 +02:00
|
|
|
|
|
2024-02-26 16:03:19 +01:00
|
|
|
|
$files = (Get-ChildItem "$PSScriptRoot/../data/dicts/*.csv")
|
2023-08-18 19:07:48 +02:00
|
|
|
|
$basename = ""
|
|
|
|
|
foreach($file in $files) {
|
|
|
|
|
$table = Import-CSV "$file"
|
|
|
|
|
foreach($row in $table) {
|
2024-02-12 18:32:09 +01:00
|
|
|
|
if ($row.TERM -ne $term) { continue }
|
2023-08-18 19:07:48 +02:00
|
|
|
|
$basename = (Get-Item "$file").Basename -Replace "_"," "
|
2024-02-12 18:32:09 +01:00
|
|
|
|
"💡 $($row.TERM) in $basename refers to: $($row.MEANING)"
|
2021-04-27 15:54:52 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-06-27 12:45:47 +02:00
|
|
|
|
if ($basename -eq "") {
|
|
|
|
|
& "$PSScriptRoot/open-URL.ps1" "https://www.google.com/search?q=what+is+$term" "🤷 Sorry, no '$term' entry found. Let's google it at: "
|
|
|
|
|
}
|
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
|
|
|
|
}
|