lib/flags: Use subtractLists for convenience

This commit is contained in:
Mikael 2024-08-24 13:16:55 +02:00
parent 3f276c26af
commit 10013701bc
Signed by: mikael
SSH key fingerprint: SHA256:21QyD2Meiot7jOUVitIR5YkGB/XuXdCvLW1hE6dsri0

View file

@ -1,7 +1,8 @@
{ nixpkgs, ... }: { nixpkgs, ... }:
let let
inherit (builtins) any filter isList isString stringLength; inherit (builtins) filter isList isString stringLength;
inherit (nixpkgs.lib.lists) subtractLists;
inherit (nixpkgs.lib.strings) addContextFrom; inherit (nixpkgs.lib.strings) addContextFrom;
split = strOrList: split = strOrList:
@ -15,7 +16,7 @@ let
else toString list; else toString list;
in { in {
remove = rem: strOrList: split strOrList remove = rem: strOrList: split strOrList
|> filter (flag: !any (elem: flag == elem) rem) |> subtractLists rem
|> remerge strOrList; |> remerge strOrList;
subst = sub: strOrList: split strOrList subst = sub: strOrList: split strOrList