Compare commits
No commits in common. "13fb093d33306341b175d5221bf77996bb9f947e" and "9201edf9458e591aea3b48c082da0727ffd38a55" have entirely different histories.
13fb093d33
...
9201edf945
2 changed files with 11 additions and 19 deletions
|
|
@ -32,7 +32,7 @@ this is just the name of the programming language you want to use; the
|
||||||
repository will pick a recommended default template for that language.
|
repository will pick a recommended default template for that language.
|
||||||
|
|
||||||
If you want more control over the generated repository, you may select a
|
If you want more control over the generated repository, you may select a
|
||||||
specific template instead. Template names are made of underscore (`_`) separated
|
specific template instead. Templates names are organized by underscore-separated
|
||||||
*fields*; the number of fields may very depending on the language, but typically
|
*fields*; the number of fields may very depending on the language, but typically
|
||||||
there are three or four:
|
there are three or four:
|
||||||
|
|
||||||
|
|
|
||||||
28
flake.nix
28
flake.nix
|
|
@ -6,15 +6,6 @@
|
||||||
concatMapAttrs = func: attr:
|
concatMapAttrs = func: attr:
|
||||||
foldl' (x: y: x // y) {} (map func attr);
|
foldl' (x: y: x // y) {} (map func attr);
|
||||||
|
|
||||||
# Display names of languages for template descriptions
|
|
||||||
display-names = {
|
|
||||||
bash = "Bash";
|
|
||||||
fish = "Fish";
|
|
||||||
c = "C";
|
|
||||||
python = "Python";
|
|
||||||
rust = "Rust";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Template Aliases
|
# Template Aliases
|
||||||
# Used to pick default template for each language
|
# Used to pick default template for each language
|
||||||
aliases = {
|
aliases = {
|
||||||
|
|
@ -42,18 +33,19 @@
|
||||||
map (l: [ subd ] ++ l) (flakeSubdirs /${dir}/${subd}))
|
map (l: [ subd ] ++ l) (flakeSubdirs /${dir}/${subd}))
|
||||||
(subdirs dir);
|
(subdirs dir);
|
||||||
|
|
||||||
generateDesc = fields:
|
generateDesc = subds:
|
||||||
let
|
"${head subds} template - ${concatStringsSep ", " (tail subds)}";
|
||||||
lang = head fields;
|
|
||||||
in "${display-names.${lang} or lang} template (${concatStringsSep ", " (tail fields)})";
|
|
||||||
in {
|
in {
|
||||||
templates = concatMapAttrs (fields: {
|
templates = concatMapAttrs (subds: {
|
||||||
${concatStringsSep "_" fields} = {
|
${concatStringsSep "_" subds} = {
|
||||||
description = generateDesc fields;
|
description = generateDesc subds;
|
||||||
path = filterSource
|
path = filterSource
|
||||||
(p: _: !(elem (baseNameOf p) template-ignore))
|
(p: _: !(elem (baseNameOf p) template-ignore))
|
||||||
(foldl' (dir: subd: /${dir}/${subd}) ./. fields);
|
(foldl' (dir: subd: /${dir}/${subd}) ./. subds);
|
||||||
};
|
};
|
||||||
}) (flakeSubdirs ./.) // mapAttrs (from: to: self.templates.${to}) aliases;
|
}) (flakeSubdirs ./.) // mapAttrs (from: to:
|
||||||
|
self.templates.${to} // {
|
||||||
|
description = generateDesc (filter (p: p != []) (split "_" to));
|
||||||
|
}) aliases;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue