fix several function args

This commit is contained in:
jacekpoz 2024-09-13 15:18:39 +02:00
parent 40771f288f
commit fac9a1ef95
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
2 changed files with 14 additions and 14 deletions

View file

@ -12,16 +12,16 @@ pkgs: src: {extraArgs, entries, templates}: let
args' = {inherit pkgs;} // extraArgs;
args = args' // {
applyTemplate = applyTemplate args';
applyTemplate = applyTemplate args' templates;
findTemplateFn = findTemplateFn templates;
getEntry = getEntry args' src;
getEntry = getEntry args' templates src;
};
processEntryFile = entryFile: let
foundTemplateFn = findTemplateFn templates entry;
entry = getEntry args src entryFile;
foundTemplateFn = findTemplateFn templates entry.template;
entry = getEntry args templates src entryFile;
in
applyTemplate args foundTemplateFn entry;
applyTemplate args templates foundTemplateFn entry;
in /*sh*/''
${concatMapStrings

View file

@ -24,7 +24,7 @@ pkgs: let
else
(import template);
applyTemplate = extraArgs: templateFn: entry: let
applyTemplate = extraArgs: templates: templateFn: entry: let
template = templateFn ({inherit pkgs;} // extraArgs // entry);
in
if isBaseTemplate template then {
@ -33,9 +33,9 @@ pkgs: let
}
else let
newEntry = template.output // {inherit (entry) file;};
foundTemplateFn = findTemplateFn newEntry;
foundTemplateFn = findTemplateFn templates newEntry.template;
in
applyTemplate foundTemplateFn newEntry;
applyTemplate extraArgs templates foundTemplateFn newEntry;
replaceSuffix = from: to: string:
if !(hasSuffix from string) then
@ -43,7 +43,7 @@ pkgs: let
else
concatStrings [ (removeSuffix from string) to ];
getTemplateFormat = extraArgs: entry: templateFn: let
getTemplateFormat = extraArgs: templates: entry: templateFn: let
# getEntry needs to go down to the base template for the format
# but any template through the way can ask for a file
# so we just give it a placeholder - an empty string here
@ -54,15 +54,15 @@ pkgs: let
template.format
else let
newEntry = template.output;
foundTemplateFn = findTemplateFn newEntry;
foundTemplateFn = findTemplateFn templates newEntry.template;
in
getTemplateFormat newEntry foundTemplateFn;
getTemplateFormat extraArgs templates newEntry foundTemplateFn;
getEntry = extraArgs: sourceDir: entryFile: let
getEntry = extraArgs: templates: sourceDir: entryFile: let
sourceFile = toString (removePrefix sourceDir entryFile);
entry = (import entryFile) ({inherit pkgs;} // extraArgs);
foundTemplateFn = findTemplateFn entry;
entryFormat = getTemplateFormat entry foundTemplateFn;
foundTemplateFn = findTemplateFn templates entry.template;
entryFormat = getTemplateFormat extraArgs templates entry foundTemplateFn;
in
if !(hasAttr "file" entry) then
entry // {