diff --git a/cool_oneliners/dict.nu b/cool_oneliners/dict.nu index 570a0fe..35ceb5a 100644 --- a/cool_oneliners/dict.nu +++ b/cool_oneliners/dict.nu @@ -6,7 +6,11 @@ def dict [word: string] { let link = (build-string 'https://api.dictionaryapi.dev/api/v2/entries/en/' ($word|str find-replace ' ' '%20')) - fetch $link | - get meanings.definitions| + let output = (fetch $link | + rename word) + + if $output.word == "No Definitions Found" {echo $output.word} {echo $output | + get meanings.definitions | select definition example + } }