refactor(readTree): Flip argument order of argFilter

Since the filters return 'args', this makes nesting of filters more
readable.

Change-Id: I775252460e3e077cc6db2fab6f3948414a95ecbf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3873
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2021-11-13 18:33:34 +01:00 committed by tazjin
parent dc8d3e869d
commit ac41d89ba5
2 changed files with 3 additions and 3 deletions

View file

@ -20,7 +20,7 @@ let
# Create a readTree filter disallowing access to the specified # Create a readTree filter disallowing access to the specified
# top-level folder in other parts of the depot, except for specific # top-level folder in other parts of the depot, except for specific
# exceptions specified by their (full) paths. # exceptions specified by their (full) paths.
restrictFolder = { folder, exceptions ? [], reason }: args: parts: restrictFolder = { folder, exceptions ? [], reason }: parts: args:
if (elemAt parts 0) == folder || elem parts exceptions if (elemAt parts 0) == folder || elem parts exceptions
then args then args
else args // { else args // {

View file

@ -64,7 +64,7 @@ let
in in
if pathType != "lambda" if pathType != "lambda"
then builtins.throw "readTree: trying to import ${toString path}, but its a ${pathType}, you need to make it a function like { depot, pkgs, ... }" then builtins.throw "readTree: trying to import ${toString path}, but its a ${pathType}, you need to make it a function like { depot, pkgs, ... }"
else importedFile (filter (argsWithPath args parts) parts); else importedFile (filter parts (argsWithPath args parts));
nixFileName = file: nixFileName = file:
let res = match "(.*)\\.nix" file; let res = match "(.*)\\.nix" file;
@ -129,7 +129,7 @@ in {
__functor = _: __functor = _:
{ path { path
, args , args
, filter ? (x: _parts: x) , filter ? (_parts: x: x)
, scopedArgs ? {} }: , scopedArgs ? {} }:
readTree { readTree {
inherit args scopedArgs; inherit args scopedArgs;