forked from lix-project/lix
move final template to the top
this allows readers to enter the code starting with what is visible from the outside, instead of working themselves up from purely technical details.
This commit is contained in:
parent
0e0f1832de
commit
61188cb820
|
@ -7,6 +7,24 @@ let
|
||||||
|
|
||||||
showCommand = { command, def, filename }:
|
showCommand = { command, def, filename }:
|
||||||
let
|
let
|
||||||
|
result = ''
|
||||||
|
> **Warning** \
|
||||||
|
> This program is **experimental** and its interface is subject to change.
|
||||||
|
|
||||||
|
# Name
|
||||||
|
|
||||||
|
`${command}` - ${def.description}
|
||||||
|
|
||||||
|
# Synopsis
|
||||||
|
|
||||||
|
${showSynopsis command def.args}
|
||||||
|
|
||||||
|
${maybeSubcommands}
|
||||||
|
|
||||||
|
${maybeDocumentation}
|
||||||
|
|
||||||
|
${maybeOptions}
|
||||||
|
'';
|
||||||
showSynopsis = command: args:
|
showSynopsis = command: args:
|
||||||
let
|
let
|
||||||
showArgument = arg: "*${arg.label}*" + (if arg ? arity then "" else "...");
|
showArgument = arg: "*${arg.label}*" + (if arg ? arity then "" else "...");
|
||||||
|
@ -60,24 +78,7 @@ let
|
||||||
'';
|
'';
|
||||||
categories = sort builtins.lessThan (unique (map (cmd: cmd.category) (attrValues options)));
|
categories = sort builtins.lessThan (unique (map (cmd: cmd.category) (attrValues options)));
|
||||||
in concatStrings (map showCategory categories);
|
in concatStrings (map showCategory categories);
|
||||||
in squash ''
|
in squash result;
|
||||||
> **Warning** \
|
|
||||||
> This program is **experimental** and its interface is subject to change.
|
|
||||||
|
|
||||||
# Name
|
|
||||||
|
|
||||||
`${command}` - ${def.description}
|
|
||||||
|
|
||||||
# Synopsis
|
|
||||||
|
|
||||||
${showSynopsis command def.args}
|
|
||||||
|
|
||||||
${maybeSubcommands}
|
|
||||||
|
|
||||||
${maybeDocumentation}
|
|
||||||
|
|
||||||
${maybeOptions}
|
|
||||||
'';
|
|
||||||
|
|
||||||
appendName = filename: name: (if filename == "nix" then "nix3" else filename) + "-" + name;
|
appendName = filename: name: (if filename == "nix" then "nix3" else filename) + "-" + name;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue