diff --git a/cool-oneliners/dict.nu b/cool-oneliners/dict.nu index b6e3bc9..fa0cba7 100644 --- a/cool-oneliners/dict.nu +++ b/cool-oneliners/dict.nu @@ -2,16 +2,20 @@ def dict [...word #word(s) to query the dictionary API but they have to make sense together like "martial law", not "cats dogs" ] { let query = ($word | str collect %20) - let link = (build-string 'https://api.dictionaryapi.dev/api/v2/entries/en/' ($query|str replace ' ' '%20')) - let output = (fetch $link | - rename word) - let w = ($output.word | first) + let link = ('https://api.dictionaryapi.dev/api/v2/entries/en/' + ($query|str replace ' ' '%20')) + let output = (fetch $link | rename word) + let w = ($output.word | first) if $w == "No Definitions Found" { echo $output.word } else { - echo $output.meanings.definitions | - flatten | flatten | - select definition example + echo $output + | get meanings + | flatten + | select partOfSpeech definitions + | flatten + | flatten + | reject "synonyms" + | reject "antonyms" } } diff --git a/filesystem/cdpath.nu b/filesystem/cdpath.nu index 3f47db5..5c592e7 100644 --- a/filesystem/cdpath.nu +++ b/filesystem/cdpath.nu @@ -20,18 +20,17 @@ def-env c [dir = ""] { } let complete_dir = if $complete_dir == "" { - error make -u {msg: "No such path"} + error make --unspanned {msg: "No such path"} } else if (($complete_dir | path expand | path type) != "dir") { - error make -u {msg: "Not a directory"} + error make --unspanned {msg: "Not a directory"} } else { ($complete_dir | path expand) } - let-env PWD = $complete_dir + cd $complete_dir } # You need to have $env.CDPATH variable declared, my suggestion from config.nu: -# UNIX: # let-env CDPATH = [".", $env.HOME, "/", ([$env.HOME, ".config"] | path join)] # WINDOWS: # let-env CDPATH = ["", $env.USERPROFILE, ([$env.USERPROFILE, "AppData\\Roaming\\"] | path join)]