1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-31 14:17:45 +00:00

replace filter with where (#1135)

This PR tries to clean up the use of `filter` by replacing it with
`where`. I did not test each script.

closes #1134
closes #1133
This commit is contained in:
Darren Schroeder 2025-06-12 06:42:16 -05:00 committed by GitHub
parent 84c25bbc6d
commit 32cdc96414
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 66 additions and 66 deletions

View file

@ -335,20 +335,20 @@ export def run-tests [
commands: (get-annotated $row.name)
}
}
| filter {|x| ($x.commands|length) > 0}
| where {|x| ($x.commands|length) > 0}
| upsert commands {|module|
$module.commands
| create-test-record
}
| flatten
| filter {|x| ($x.test|length) > 0}
| filter {|x| if ($exclude_module|is-empty) {true} else {$x.name !~ $exclude_module}}
| filter {|x| if ($test|is-empty) {true} else {$x.test|any {|y| $y =~ $test}}}
| filter {|x| if ($module|is-empty) {true} else {$module == $x.name}}
| where {|x| ($x.test|length) > 0}
| where {|x| if ($exclude_module|is-empty) {true} else {$x.name !~ $exclude_module}}
| where {|x| if ($test|is-empty) {true} else {$x.test|any {|y| $y =~ $test}}}
| where {|x| if ($module|is-empty) {true} else {$module == $x.name}}
| update test {|x|
$x.test
| filter {|y| if ($test|is-empty) {true} else {$y =~ $test}}
| filter {|y| if ($exclude|is-empty) {true} else {$y !~ $exclude}}
| where {|y| if ($test|is-empty) {true} else {$y =~ $test}}
| where {|y| if ($exclude|is-empty) {true} else {$y !~ $exclude}}
}
)
if $list {