Update what-is.ps1 and rename to data/dictionaries/

This commit is contained in:
Markus Fleschutz
2024-02-12 18:32:09 +01:00
parent d753e11173
commit 2a886f87d5
27 changed files with 41 additions and 52 deletions

View File

@ -18,14 +18,14 @@ param([string]$term = "")
try {
if ($term -eq "" ) { $term = Read-Host "Enter the term/abbreviation/etc. to query" }
$files = (Get-ChildItem "$PSScriptRoot/../data/abbr/*.csv")
$files = (Get-ChildItem "$PSScriptRoot/../data/dictionaries/*.csv")
$basename = ""
foreach($file in $files) {
$table = Import-CSV "$file"
foreach($row in $table) {
if ($row.ABBR -ne $term) { continue }
if ($row.TERM -ne $term) { continue }
$basename = (Get-Item "$file").Basename -Replace "_"," "
"💡 $($row.ABBR) in $basename refers to: $($row.MEANING)"
"💡 $($row.TERM) in $basename refers to: $($row.MEANING)"
}
}
if ($basename -eq "") { "🤷‍ Sorry, no '$term' entry found. Use <Ctrl> <Click> to google it: https://www.google.com/search?q=abbreviation+$term" }