chore: fmt

This commit is contained in:
2025-11-24 18:04:11 +08:00
parent 97761a3af5
commit 3d116fe3a7
4 changed files with 50 additions and 26 deletions

View File

@@ -19,18 +19,36 @@ in
add_newline = false;
command_timeout = 2000;
nix_shell.disabled = true;
format = let
dedupDollar = list: let
result = builtins.foldl' (acc: elem:
if lib.hasPrefix "$" elem then
if builtins.elem elem acc.seen
then acc
else acc // { result = acc.result ++ [elem]; seen = acc.seen ++ [elem]; }
else
acc // { result = acc.result ++ [elem]; }
) { result = []; seen = []; } (lib.reverseList list);
in lib.reverseList result.result;
in "$all" + lib.concatStrings (dedupDollar cfg.format);
format =
let
dedupDollar =
list:
let
result =
builtins.foldl'
(
acc: elem:
if lib.hasPrefix "$" elem then
if builtins.elem elem acc.seen then
acc
else
acc
// {
result = acc.result ++ [ elem ];
seen = acc.seen ++ [ elem ];
}
else
acc // { result = acc.result ++ [ elem ]; }
)
{
result = [ ];
seen = [ ];
}
(lib.reverseList list);
in
lib.reverseList result.result;
in
"$all" + lib.concatStrings (dedupDollar cfg.format);
};
};
};