From 3e0bdf088f5a236541fc9e1931fd9459a6438d75 Mon Sep 17 00:00:00 2001 From: Kamil Date: Wed, 3 Nov 2021 04:51:37 +0000 Subject: [PATCH] =?UTF-8?q?dict.nu=20=E2=80=94=20bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cool_oneliners/dict.nu | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cool_oneliners/dict.nu b/cool_oneliners/dict.nu index 35ceb5a..d890e84 100644 --- a/cool_oneliners/dict.nu +++ b/cool_oneliners/dict.nu @@ -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 }