mirror of
https://github.com/NixOS/nix
synced 2025-06-24 18:01:16 +02:00
Group subcommands by category
This commit is contained in:
parent
3ba98ba8f0
commit
807d963ee8
3 changed files with 32 additions and 6 deletions
|
@ -1,7 +1,15 @@
|
|||
with builtins;
|
||||
|
||||
{
|
||||
rec {
|
||||
splitLines = s: filter (x: !isList x) (split "\n" s);
|
||||
|
||||
concatStrings = concatStringsSep "";
|
||||
|
||||
# FIXME: O(n^2)
|
||||
unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
|
||||
|
||||
nameValuePair = name: value: { inherit name value; };
|
||||
|
||||
filterAttrs = pred: set:
|
||||
listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue