From 85ca45644baac1cb04aece9650580fe117435ed9 Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Fri, 1 Aug 2025 03:23:39 -0400 Subject: [PATCH] chore: Remove deprecated `filter` command (#439) --- modules/dnf/dnf.nu | 16 ++++++++-------- modules/dnf/dnf_interface.nu | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/dnf/dnf.nu b/modules/dnf/dnf.nu index a8a8955..015b2db 100644 --- a/modules/dnf/dnf.nu +++ b/modules/dnf/dnf.nu @@ -240,7 +240,7 @@ def add_repos [$repos: list]: nothing -> list { # Return the IDs of all repos that were added let repo_ids = $repo_info - | filter {|repo| + | where {|repo| $repo.repo_file_path in $repo_files } | get id @@ -485,24 +485,24 @@ def install_pkgs [install: record]: nothing -> nothing { # Gather lists of the various ways a package is installed # to report back to the user. let install_list = $install.packages - | filter {|pkg| + | where {|pkg| ($pkg | describe) == 'string' } | str replace --all '%OS_VERSION%' $env.OS_VERSION | str trim let http_list = $install_list - | filter {|pkg| + | where {|pkg| ($pkg | str starts-with 'https://') or ($pkg | str starts-with 'http://') } let local_list = $install_list | each {|pkg| [$env.CONFIG_DIRECTORY dnf $pkg] | path join } - | filter {|pkg| + | where {|pkg| ($pkg | path exists) } let normal_list = $install_list - | filter {|pkg| + | where {|pkg| not ( ($pkg | str starts-with 'https://') or ($pkg | str starts-with 'http://') ) and not ( @@ -549,7 +549,7 @@ def install_pkgs [install: record]: nothing -> nothing { # Get all the entries that have a repo specified. let repo_install_list = $install.packages - | filter {|pkg| + | where {|pkg| 'repo' in $pkg and 'packages' in $pkg } @@ -602,9 +602,9 @@ def replace_pkgs [replace_list: list]: nothing -> nothing { | get from-repo let swap_packages = $replacement.packages - | filter $check + | where $check let sync_packages = $replacement.packages - | filter { + | where { not (do $check $in) } diff --git a/modules/dnf/dnf_interface.nu b/modules/dnf/dnf_interface.nu index 0dafbd8..6414d4c 100644 --- a/modules/dnf/dnf_interface.nu +++ b/modules/dnf/dnf_interface.nu @@ -334,9 +334,9 @@ export def "dnf version" []: nothing -> record { let dnf = which dnf4 dnf5 if ("dnf5" in ($dnf | get command)) { - $dnf | filter { $in.command == "dnf5" } | first + $dnf | where command == "dnf5" | first } else if ("dnf4" in ($dnf | get command)) { - $dnf | filter { $in.command == "dnf4" } | first + $dnf | where command == "dnf4" | first } else { return (error make { msg: $"(ansi red)ERROR: Main dependency '(ansi cyan)dnf5/dnf4(ansi red)' is not installed. Install '(ansi cyan)dnf5/dnf4(ansi red)' before using this module to solve this error.(ansi reset)"