mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-24 02:48:17 +02:00
Update what-is.ps1
This commit is contained in:
parent
772fdb2b68
commit
6d75ce1ec5
@ -4867,7 +4867,6 @@ VSR,Very Special Relativity
|
|||||||
VT,Vatican City-State (FIPS 10-4 country code),Vermont (postal symbol),Video tape,Virginia Tech
|
VT,Vatican City-State (FIPS 10-4 country code),Vermont (postal symbol),Video tape,Virginia Tech
|
||||||
VTC,Video Tele-Conference
|
VTC,Video Tele-Conference
|
||||||
VTEC,Variable valve Timing and Electronic lift Control
|
VTEC,Variable valve Timing and Electronic lift Control
|
||||||
VTOL,Vertical Take-Off & Landing
|
|
||||||
VU,Vanuatu (ISO 3166 digram),Vedanta University
|
VU,Vanuatu (ISO 3166 digram),Vedanta University
|
||||||
VUB,Vrije Universiteit Brussel (Belgian university)
|
VUB,Vrije Universiteit Brussel (Belgian university)
|
||||||
VUT,Vanuatu (ISO 3166 trigram)
|
VUT,Vanuatu (ISO 3166 trigram)
|
||||||
|
Can't render this file because it has a wrong number of fields in line 7.
|
@ -2,11 +2,12 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Explains an abbreviation
|
Explains an abbreviation
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script queries the description of the given abbreviation and prints it.
|
This PowerShell script queries the meaning of the given abbreviation and prints it.
|
||||||
.PARAMETER abbr
|
.PARAMETER abbr
|
||||||
Specifies the abbreviation to look for
|
Specifies the abbreviation to query
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./what-is IAS
|
PS> ./what-is VTOL
|
||||||
|
💡 VTOL in aviation refers to: Vertical Take-Off and Landing
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -16,21 +17,18 @@
|
|||||||
param([string]$abbr = "")
|
param([string]$abbr = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($abbr -eq "" ) { $abbr = Read-Host "Enter the abbreviation" }
|
if ($abbr -eq "" ) { $abbr = Read-Host "Enter the abbreviation to query" }
|
||||||
|
$files = (Get-ChildItem "$PSScriptRoot/../Data/Abbr/*.csv")
|
||||||
$Files = (Get-ChildItem "$PSScriptRoot/../Data/Abbr/*.csv")
|
$basename = ""
|
||||||
[int]$Matches = 0
|
foreach($file in $files) {
|
||||||
foreach($File in $Files) {
|
$table = Import-CSV "$file"
|
||||||
$Table = Import-CSV "$File"
|
foreach($row in $table) {
|
||||||
foreach($Row in $Table) {
|
if ($row.ABBR -ne $abbr) { continue }
|
||||||
if ($Row.ABBR -eq $abbr) {
|
$basename = (Get-Item "$file").Basename -Replace "_"," "
|
||||||
$Basename = (Get-Item "$File").Basename -Replace "_"," "
|
"💡 $($row.ABBR) in $basename refers to: $($row.MEANING)"
|
||||||
"💡 $($Row.ABBR) in $Basename refers to: $($Row.MEANING)"
|
|
||||||
$Matches++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if ($basename -eq "") { "🤷 Sorry, my databases have no '$abbr' entry." }
|
||||||
if ($Matches -eq 0) { "Sorry, '$abbr' is missing in the database." }
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user