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)) (attrNames def.commands))
+ "\n" + "\n"
else "") 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 + (if def ? doc
then "# Description\n\n" + def.doc + "\n\n" then "# Description\n\n" + def.doc + "\n\n"
else "") else "")
@ -27,11 +32,7 @@ let
if s != "" if s != ""
then "# Flags\n\n${s}" then "# Flags\n\n${s}"
else "") 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; appendName = filename: name: (if filename == "nix" then "nix3" else filename) + "-" + name;