1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

dict.nu — bugfix

fixed coercion error that used to be thrown, when the column word contained more than one item. should be working fully correctly right now, feedback appreciated tho
This commit is contained in:
Kamil 2021-11-03 04:51:37 +00:00 committed by GitHub
parent ffc36c2b18
commit 3e0bdf088f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,8 +8,9 @@ def dict [word: string] {
let link = (build-string 'https://api.dictionaryapi.dev/api/v2/entries/en/' ($word|str find-replace ' ' '%20'))
let output = (fetch $link |
rename word)
if $output.word == "No Definitions Found" {echo $output.word} {echo $output |
let w = ($output.word | first)
if $w == "No Definitions Found" {echo $output.word} {echo $output |
get meanings.definitions |
select definition example
}