Put examples first in the manpages

This commit is contained in:
Eelco Dolstra 2020-12-02 23:19:16 +01:00
parent 72428e38d9
commit e2efc63979

View file

@ -20,6 +20,11 @@ let
(attrNames def.commands))
+ "\n"
else "")
+ (if def.examples or [] != []
then
"# Examples\n\n"
+ concatStrings (map ({ description, command }: "${description}\n\n```console\n${command}\n```\n\n") def.examples)
else "")
+ (if def ? doc
then "# Description\n\n" + def.doc + "\n\n"
else "")
@ -27,11 +32,7 @@ let
if s != ""
then "# Flags\n\n${s}"
else "")
+ (if def.examples or [] != []
then
"# Examples\n\n"
+ concatStrings (map ({ description, command }: "${description}\n\n```console\n${command}\n```\n\n") def.examples)
else "");
;
appendName = filename: name: (if filename == "nix" then "nix3" else filename) + "-" + name;