Updated what-is.ps1

This commit is contained in:
Markus Fleschutz
2024-06-27 12:45:47 +02:00
parent d796331f19
commit 75ef111a18
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,7 @@
Specifies the term to query
.EXAMPLE
PS> ./what-is VTOL
💡 VTOL in aviation refers to Vertical Take-Off and Landing
💡 VTOL in aviation refers to: Vertical Take-Off and Landing
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -18,6 +18,7 @@ param([string]$term = "")
try {
if ($term -eq "" ) { $term = Read-Host "Enter the term/abbreviation/etc. to query" }
$files = (Get-ChildItem "$PSScriptRoot/../data/dicts/*.csv")
$basename = ""
foreach($file in $files) {
@ -28,7 +29,9 @@ try {
"💡 $($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=what+is+$term" }
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: "
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"