diff --git a/custom-completions/cargo-loco/cargo-loco-completions.nu b/custom-completions/cargo-loco/cargo-loco-completions.nu index 625e4e9..f6f952c 100644 --- a/custom-completions/cargo-loco/cargo-loco-completions.nu +++ b/custom-completions/cargo-loco/cargo-loco-completions.nu @@ -279,7 +279,7 @@ def columns [ ] if not ($query | is-empty) { - $columns = $columns | filter { + $columns = $columns | where { $in | str contains --ignore-case $query } } diff --git a/custom-completions/flutter/flutter-completions.nu b/custom-completions/flutter/flutter-completions.nu index f1df489..4b393e0 100644 --- a/custom-completions/flutter/flutter-completions.nu +++ b/custom-completions/flutter/flutter-completions.nu @@ -14,7 +14,7 @@ def "nu-complete flutter commands" [] { | into string | str replace --regex --multiline '(Manage[\s\S]*(?=Flutter SDK))' '' | lines - | filter { str starts-with " " } + | where { str starts-with " " } | each { str trim } | parse "{value} {description}" | str trim @@ -33,7 +33,7 @@ def "nu-complete pub commands" [] { | into string | str replace --regex --multiline '(Commands[\s\S]*(?=Available subcommands))' '' | lines - | filter { str starts-with " " } + | where { str starts-with " " } | each { str trim } | parse "{value} {description}" | str trim diff --git a/custom-completions/gh/gh-completions.nu b/custom-completions/gh/gh-completions.nu index 76ff843..c53e0c9 100644 --- a/custom-completions/gh/gh-completions.nu +++ b/custom-completions/gh/gh-completions.nu @@ -2,7 +2,7 @@ def "nu-complete gh" [] { ^gh --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -16,7 +16,7 @@ export extern "gh" [ def "nu-complete gh auth" [] { ^gh auth --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -43,7 +43,7 @@ export extern "gh browse" [ def "nu-complete gh codespace" [] { ^gh codespace --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -57,7 +57,7 @@ export extern "gh codespace" [ def "nu-complete gh gist" [] { ^gh gist --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -129,7 +129,7 @@ export extern "gh gist view" [ def "nu-complete gh issue" [] { ^gh issue --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -144,7 +144,7 @@ export extern "gh issue" [ def "nu-complete gh org" [] { ^gh org --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -156,7 +156,7 @@ export extern "gh org" [ ] def "nu-complete gh pr" [] { - ^gh pr --help | lines | filter { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim + ^gh pr --help | lines | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim } export extern "gh pr" [ @@ -182,7 +182,7 @@ export extern "gh pr checkout" [ def "nu-complete gh project" [] { ^gh project --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -196,7 +196,7 @@ export extern "gh project" [ def "nu-complete gh release" [] { ^gh release --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -211,7 +211,7 @@ export extern "gh release" [ def "nu-complete gh repo" [] { ^gh repo --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -310,7 +310,7 @@ export extern "gh repo fork" [ def "nu-complete gh cache" [] { ^gh cache --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -325,7 +325,7 @@ export extern "gh cache" [ def "nu-complete gh run" [] { ^gh run --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -339,7 +339,7 @@ export extern "gh run" [ def "nu-complete gh workflow" [] { ^gh workflow --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -354,7 +354,7 @@ export extern "gh workflow" [ def "nu-complete gh alias" [] { ^gh alias --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -403,7 +403,7 @@ export extern "gh completion" [ def "nu-complete gh config" [] { ^gh config --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -417,7 +417,7 @@ export extern "gh config" [ def "nu-complete gh extension" [] { ^gh extension --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -431,7 +431,7 @@ export extern "gh extension" [ def "nu-complete gh gpg-key" [] { ^gh gpg-key --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -445,7 +445,7 @@ export extern "gh gpg-key" [ def "nu-complete gh label" [] { ^gh label --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -460,7 +460,7 @@ export extern "gh label" [ def "nu-complete gh ruleset" [] { ^gh ruleset --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -475,7 +475,7 @@ export extern "gh ruleset" [ def "nu-complete gh search" [] { ^gh search --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -501,7 +501,7 @@ export extern "gh search" [ def "nu-complete gh secret" [] { ^gh secret --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -516,7 +516,7 @@ export extern "gh secret" [ def "nu-complete gh ssh-key" [] { ^gh ssh-key --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim @@ -536,7 +536,7 @@ export extern "gh status" [ def "nu-complete gh variable" [] { ^gh variable --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | skip 1 | parse "{value}: {description}" | str trim diff --git a/custom-completions/just/just-completions.nu b/custom-completions/just/just-completions.nu index a3eb33e..d016c20 100644 --- a/custom-completions/just/just-completions.nu +++ b/custom-completions/just/just-completions.nu @@ -37,7 +37,7 @@ def "nu-complete args" [context:string,offset:int] { def get-just-arg [name:string,position:int] { let recipes = ( get-recipes - | filter {|r| $r.name == $name } + | where {|r| $r.name == $name } | get parameters | flatten) let len = $recipes | length diff --git a/custom-completions/kw/kw-completions.nu b/custom-completions/kw/kw-completions.nu index c693456..2964d69 100644 --- a/custom-completions/kw/kw-completions.nu +++ b/custom-completions/kw/kw-completions.nu @@ -85,7 +85,7 @@ def "nu-complete kw configs" [] { def "nu-complete kw remotes" [] { ^kw remote --list | lines - | filter {|line| not ($line | str contains " ")} + | where {|line| not ($line | str contains " ")} } # The inglorious kernel developer workflow tool diff --git a/custom-completions/lftp/lftp-completions.nu b/custom-completions/lftp/lftp-completions.nu index 7f3216f..273154f 100644 --- a/custom-completions/lftp/lftp-completions.nu +++ b/custom-completions/lftp/lftp-completions.nu @@ -44,7 +44,7 @@ module lftp-completion-utils { let files = [ '/etc/ssh/ssh_config', '~/.ssh/config' - ] | filter {|file| $file | path exists } + ] | where {|file| $file | path exists } let first_result: record>, includes: list> = $files | par-each {|file| diff --git a/custom-completions/mask/mask-completions.nu b/custom-completions/mask/mask-completions.nu index 2a4f901..c741a26 100644 --- a/custom-completions/mask/mask-completions.nu +++ b/custom-completions/mask/mask-completions.nu @@ -34,7 +34,7 @@ def "nu-complete mask args" [context: string, offset: int] { $rt ++= ($c | get named_flags | each {|x| let v = if not ($x.long | is-empty) { $"`--($x.long)`" } else if not ($x.short | is-empty) { $"`-($x.short)`" } else { $"---($x.name)" } let a = ["required", "multiple", "takes_value", "validate_as_number"] - | filter {|y| ($x | get $y) == true } + | where {|y| ($x | get $y) == true } | str join ',' let d = if ($a | is-empty) { $x.description } else { $"($x.description) \(($a))" } {value: $v , description: $d } diff --git a/custom-completions/pass/nu-complete/mod.nu b/custom-completions/pass/nu-complete/mod.nu index c26606a..c9ac5b4 100644 --- a/custom-completions/pass/nu-complete/mod.nu +++ b/custom-completions/pass/nu-complete/mod.nu @@ -21,7 +21,7 @@ export def "nu-complete pass-directories" [] { let dir = (pass_completions_directory) ls ($dir | path join **) | get name - | filter { |it| not (ls $it | is-empty) } + | where { |it| not (ls $it | is-empty) } | each {|it| ( $it | path relative-to $dir) } } diff --git a/custom-completions/rye/rye-completions.nu b/custom-completions/rye/rye-completions.nu index 1ee37ab..0310109 100644 --- a/custom-completions/rye/rye-completions.nu +++ b/custom-completions/rye/rye-completions.nu @@ -5,7 +5,7 @@ export extern "rye" [ def "nu-complete rye" [] { ^rye --help | lines - | filter { str starts-with " " } + | where { str starts-with " " } | each {str trim} | parse "{value} {description}" | str trim @@ -120,7 +120,7 @@ def "nu-complete rye tools" [] { ^rye tools --help | lines | drop 1 - | filter { str starts-with " " } + | where { str starts-with " " } | each {str trim} | parse "{value} {description}" | str trim @@ -135,7 +135,7 @@ def "nu-complete rye self" [] { ^rye self --help | lines | drop 1 - | filter { str starts-with " " } + | where { str starts-with " " } | each {str trim} | parse "{value} {description}" | str trim @@ -150,7 +150,7 @@ def "nu-complete rye toolchain" [] { ^rye toolchain --help | lines | drop 1 - | filter { str starts-with " " } + | where { str starts-with " " } | each {str trim} | parse "{value} {description}" | str trim diff --git a/custom-completions/ssh/ssh-completions.nu b/custom-completions/ssh/ssh-completions.nu index bd97f92..abbd381 100644 --- a/custom-completions/ssh/ssh-completions.nu +++ b/custom-completions/ssh/ssh-completions.nu @@ -79,7 +79,7 @@ def "nu-complete ssh-host" [] { let files = [ '/etc/ssh/ssh_config', '~/.ssh/config' - ] | filter {|file| $file | path exists } + ] | where {|file| $file | path exists } use ssh-completion-utils process diff --git a/custom-completions/winget/winget-completions.nu b/custom-completions/winget/winget-completions.nu index a90f3de..8e13a81 100644 --- a/custom-completions/winget/winget-completions.nu +++ b/custom-completions/winget/winget-completions.nu @@ -369,7 +369,7 @@ export def "winget list" [ (do $flagify help $help) ] | flatten - | filter { not ($in | is-empty) }) + | where { not ($in | is-empty) }) ) let output = ^winget ...$params diff --git a/modules/completion-generator/completion-generator.nu b/modules/completion-generator/completion-generator.nu index 16e9a13..691ecdd 100644 --- a/modules/completion-generator/completion-generator.nu +++ b/modules/completion-generator/completion-generator.nu @@ -28,7 +28,7 @@ export def 'from tree' [ if not ($fst in ['list', 'record']) { $acc } else { - let r = $acc.schema | filter {|i| ($i | get $selector.value) == $x} + let r = $acc.schema | where {|i| ($i | get $selector.value) == $x} if ($r | is-empty) { $acc } else { diff --git a/modules/docker/mod.nu b/modules/docker/mod.nu index e9f0940..aa23cfe 100644 --- a/modules/docker/mod.nu +++ b/modules/docker/mod.nu @@ -97,7 +97,7 @@ export def image-select [name] { let imgs = (image-list) let fs = [image tag repo] for i in 2..0 { - let r = $imgs | filter {|x| + let r = $imgs | where {|x| $fs | slice 0..$i | all {|y| ($n | get $y) == ($x | get $y) } } if ($r | is-not-empty) { diff --git a/modules/git/git.nu b/modules/git/git.nu index 38c2674..c9e5338 100644 --- a/modules/git/git.nu +++ b/modules/git/git.nu @@ -60,7 +60,7 @@ def "nu-complete git log" [] { 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)"} } diff --git a/modules/git/git_branch_cleanup.nu b/modules/git/git_branch_cleanup.nu index 8f0ebfd..3e96fa9 100644 --- a/modules/git/git_branch_cleanup.nu +++ b/modules/git/git_branch_cleanup.nu @@ -141,7 +141,7 @@ def list_merged [ run-external "git" "branch" ...$args | lines - | filter {|branch| + | where {|branch| $keep | all {|pattern| $branch !~ $'\A($pattern)\z' diff --git a/modules/gitv2/mod.nu b/modules/gitv2/mod.nu index 51de511..e73462b 100644 --- a/modules/gitv2/mod.nu +++ b/modules/gitv2/mod.nu @@ -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" [] { diff --git a/modules/history-utils/mod.nu b/modules/history-utils/mod.nu index fee6b93..ed0b2c8 100644 --- a/modules/history-utils/mod.nu +++ b/modules/history-utils/mod.nu @@ -3,7 +3,7 @@ def quote [...t] { } def flatten_fields [args] { - let f = $in | default [] | filter {|x| $x | is-not-empty } + let f = $in | default [] | where {|x| $x | is-not-empty } let prefix = $args.0 let inner = $args.1 let outer = $args.2 diff --git a/modules/kubernetes/resources.nu b/modules/kubernetes/resources.nu index 82c836c..744dacd 100644 --- a/modules/kubernetes/resources.nu +++ b/modules/kubernetes/resources.nu @@ -16,7 +16,7 @@ export def kube-refine [ let cns = kubectl get namespace | from ssv -a | get NAME - | filter $nsf + | where $nsf let resource = kubectl get crd | from ssv | get NAME let resource = kubectl api-resources | from ssv -a | get NAME | append $resource @@ -24,7 +24,7 @@ export def kube-refine [ $resource } else { $resource - | filter {|x| $x in $kind } + | where {|x| $x in $kind } } mut data = [] diff --git a/modules/lg/mod.nu b/modules/lg/mod.nu index a46c95c..584fb54 100644 --- a/modules/lg/mod.nu +++ b/modules/lg/mod.nu @@ -77,7 +77,7 @@ export def --wrapped level [ | each (do $env.lg.line_formatter $theme $align $mkl) | str join (char newline) let head = [$time $label $txt] - | filter {|x| $x | is-not-empty } + | where {|x| $x | is-not-empty } | str join $theme.delimiter [$head $body] | str join (char newline) } else { @@ -85,7 +85,7 @@ export def --wrapped level [ | each {|y| $"($theme.bg)($y.k)=($theme.fg)($y.v)"} | str join ' ' [$time $label $tag $txt] - | filter {|x| $x | is-not-empty } + | where {|x| $x | is-not-empty } | str join $theme.delimiter } $r + $theme.terminal | do $output diff --git a/modules/ls_mods/ls-hidden.nu b/modules/ls_mods/ls-hidden.nu index 52b0185..dfef3ab 100644 --- a/modules/ls_mods/ls-hidden.nu +++ b/modules/ls_mods/ls-hidden.nu @@ -3,5 +3,5 @@ export def ls-hidden [ --dir(-d):any # The directory you want to list ] { let dir = if ($dir | is-empty) { "." } else { $dir } - ls -a $dir | filter { ($in.name | into string | str starts-with '.') } + ls -a $dir | where { ($in.name | into string | str starts-with '.') } } diff --git a/modules/yadm/mod.nu b/modules/yadm/mod.nu index dc05e57..3000471 100755 --- a/modules/yadm/mod.nu +++ b/modules/yadm/mod.nu @@ -60,7 +60,7 @@ flag_record:record # A object filled all known flags and their values. } - | filter { |value| ( $value | describe ) != nothing } + | where { |value| ( $value | describe ) != nothing } } diff --git a/sourced/filesystem/cdpath.nu b/sourced/filesystem/cdpath.nu index 1f556d0..d9157a2 100644 --- a/sourced/filesystem/cdpath.nu +++ b/sourced/filesystem/cdpath.nu @@ -25,7 +25,7 @@ module cdpath { $env.CDPATH | path expand | uniq - | filter {|| $in | path exists } + | where {|| $in | path exists } } # Children of a path @@ -59,7 +59,7 @@ module cdpath { let first = $path | first complete_from_cdpath - | filter {|| $in.value | str contains $first } + | where {|| $in.value | str contains $first } | upsert value {|| $"($in.value)/" } # Complete a child of a CDPATH entry } else { @@ -86,14 +86,14 @@ module cdpath { | each {|| $in | path join $prefix } - | filter {|| + | where {|| $in | path exists } | first } children $chosen_path - | filter {|| + | where {|| $in | str contains $last } | each {|child| diff --git a/sourced/nu_101/emulating_other_data_structures.nu b/sourced/nu_101/emulating_other_data_structures.nu index faf10ba..eb54a7e 100644 --- a/sourced/nu_101/emulating_other_data_structures.nu +++ b/sourced/nu_101/emulating_other_data_structures.nu @@ -60,7 +60,7 @@ $set ++ $set_b | uniq ### Intersection -$set | filter { |elem| $elem in $set_b } +$set | where { |elem| $elem in $set_b } # Result: [2 3] @@ -68,7 +68,7 @@ $set | filter { |elem| $elem in $set_b } # $set - $set_b -$set | filter { |elem| $elem not-in $set_b } +$set | where { |elem| $elem not-in $set_b } # or diff --git a/sourced/todo.nu b/sourced/todo.nu index a661fb5..9e72d4e 100644 --- a/sourced/todo.nu +++ b/sourced/todo.nu @@ -53,7 +53,7 @@ def todo [ get_todo | reverse # change ($num - 1) to $num to have zero-based indexing - | filter {|it, n| $n != ($num - 1) } + | where {|it, n| $n != ($num - 1) } | reverse | save $env.TODO -f } diff --git a/stdlib-candidate-archive/testing.nu b/stdlib-candidate-archive/testing.nu index 279a9dd..2eb5922 100644 --- a/stdlib-candidate-archive/testing.nu +++ b/stdlib-candidate-archive/testing.nu @@ -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 {