1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

Fixed bug where find_in globs were matching directories (#980)

This commit is contained in:
Blake Miner 2024-11-06 17:08:08 -05:00 committed by GitHub
parent 58f8c75688
commit e380c8a355
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,10 +3,10 @@ def "find in" [
glob: glob, # the glob expression
...rest: any # terms to search
]: nothing -> table<path: string, line: int, data: string> {
glob $glob
glob --no-dir $glob
| par-each {|e|
open $e | lines | enumerate | rename line data |
find -c [data] ...$rest |
find --columns [data] ...$rest |
each {|match| {path: ($e | path relative-to $env.PWD), ...$match}}
} | flatten
}