mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
Create dict.nu
This commit is contained in:
parent
265a16694f
commit
04b7eb3360
1 changed files with 12 additions and 0 deletions
12
cool_oneliners/dict.nu
Normal file
12
cool_oneliners/dict.nu
Normal file
|
@ -0,0 +1,12 @@
|
|||
#As the name suggests, the function returns you the definition and example of the sought English word
|
||||
#(or breaks if it can't find the word because the API uses different columns for successful and invalid searches)
|
||||
|
||||
#usage: dict word
|
||||
#usage: dict "word with space"
|
||||
|
||||
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|
|
||||
select definition example
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue