Files
dotfiles/dot_config/nushell/nu_scripts/modules/parsing/sample_andres.nu
Cian Hughes 896af887ca Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
2024-11-07 13:52:17 +00:00

22 lines
522 B
Nu

def look_for [word] {
open sample_andres.json |
flatten |
flatten |
insert comp {
get shoes_name |
split row " " |
enumerate | each {
[[idx, loc]; [$in.index, ($in.item | str index-of $word)]]
} | flatten
} |
flatten |
where comp.loc >= 0 |
flatten |
update idx { $in + 1 } |
reject name price loc |
rename nameWords targetWordIndex
}
print (look_for "leather" | to json --indent 4)
print (look_for "low-top" | to json --indent 4)