feat(readTree): Add special here argument.
It's convenient for depending on sub-tree members of the current file as well as gives access to siblings. Change-Id: I74234cec6566177d88d3bc8507fa3f6ec789adb8 Reviewed-on: https://cl.snix.dev/c/snix/+/30098 Reviewed-by: adis bladis <adisbladis@gmail.com> Tested-by: besadii
This commit is contained in:
parent
39b3e2c410
commit
a04c73ca83
7 changed files with 39 additions and 15 deletions
|
|
@ -125,7 +125,7 @@ let
|
|||
self =
|
||||
if rootDir
|
||||
then { __readTree = [ ]; }
|
||||
else importFile args scopedArgs initPath parts argsFilter;
|
||||
else importFile (args // { here = result; }) scopedArgs initPath parts argsFilter;
|
||||
|
||||
# Import subdirectories of the current one, unless any skip
|
||||
# instructions exist.
|
||||
|
|
@ -162,7 +162,7 @@ let
|
|||
let
|
||||
p = joinChild (c + ".nix");
|
||||
childParts = parts ++ [ c ];
|
||||
imported = importFile args scopedArgs p childParts argsFilter;
|
||||
imported = importFile (args // { here = result; }) scopedArgs p childParts argsFilter;
|
||||
in
|
||||
{
|
||||
name = c;
|
||||
|
|
@ -181,14 +181,16 @@ let
|
|||
else nixChildren ++ children
|
||||
);
|
||||
|
||||
result =
|
||||
if isAttrs nodeValue
|
||||
then merge nodeValue (allChildren // (marker parts allChildren))
|
||||
else nodeValue;
|
||||
|
||||
in
|
||||
if skipTree
|
||||
then { skip = true; }
|
||||
else {
|
||||
ok =
|
||||
if isAttrs nodeValue
|
||||
then merge nodeValue (allChildren // (marker parts allChildren))
|
||||
else nodeValue;
|
||||
ok = result;
|
||||
};
|
||||
|
||||
# Top-level implementation of readTree itself.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue