1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +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

@ -101,7 +101,7 @@ export def gb [
git branch -D $b
}
if ($dels | is-not-empty) and (agree 'delete remote branch?!') {
for b in ($dels | filter { $"($remote)/($in)" in $remote_branches }) {
for b in ($dels | where { $"($remote)/($in)" in $remote_branches }) {
tips $"delete (ansi yellow)($remote)/($b)"
git branch -D -r $'($remote)/($b)'
git push $remote -d $b
@ -657,13 +657,13 @@ def "nu-complete git branch files" [context: string, offset:int] {
let files = $token | skip 2
git ls-tree -r --name-only $branch
| lines
| filter {|x| not ($x in $files)}
| where {|x| not ($x in $files)}
}
def "nu-complete git branches" [] {
git branch
| lines
| filter {|x| not ($x | str starts-with '*')}
| where {|x| not ($x | str starts-with '*')}
| each {|x| $"($x|str trim)"}
}
@ -671,7 +671,7 @@ export def remote_branches [] {
git branch -r
| lines
| str trim
| filter {|x| not ($x | str starts-with 'origin/HEAD') }
| where {|x| not ($x | str starts-with 'origin/HEAD') }
}
def "nu-complete git remotes" [] {