diff options
author | Valentin Gagarin <valentin.gagarin@tweag.io> | 2022-08-27 02:44:54 +0200 |
---|---|---|
committer | Valentin Gagarin <valentin.gagarin@tweag.io> | 2022-09-30 01:43:57 +0200 |
commit | 61188cb820cd71d7f0ea74f11791c208e69aa632 (patch) | |
tree | e552aaba87af81e0f00aba01bdd5b87f9c16ce19 | |
parent | 0e0f1832de10bf200bca2b2b3e886c7255999216 (diff) |
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.
-rw-r--r-- | doc/manual/generate-manpage.nix | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/doc/manual/generate-manpage.nix b/doc/manual/generate-manpage.nix index 2428ee1b3..273b6bce3 100644 --- a/doc/manual/generate-manpage.nix +++ b/doc/manual/generate-manpage.nix @@ -7,6 +7,24 @@ let showCommand = { command, def, filename }: 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: let 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))); in concatStrings (map showCategory categories); - in squash '' - > **Warning** \ - > This program is **experimental** and its interface is subject to change. - - # Name - - `${command}` - ${def.description} - - # Synopsis - - ${showSynopsis command def.args} - - ${maybeSubcommands} - - ${maybeDocumentation} - - ${maybeOptions} - ''; + in squash result; appendName = filename: name: (if filename == "nix" then "nix3" else filename) + "-" + name; |