From 6b56bb4a79a3aa20160c21ec7e5e17e9c4b2b6c3 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Fri, 26 Aug 2022 17:08:20 +0200 Subject: [PATCH] use indented strings where appropriate --- doc/manual/generate-manpage.nix | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/manual/generate-manpage.nix b/doc/manual/generate-manpage.nix index 17701c3a3..7b1ca8c11 100644 --- a/doc/manual/generate-manpage.nix +++ b/doc/manual/generate-manpage.nix @@ -8,12 +8,18 @@ let showCommand = { command, def, filename }: '' - **Warning**: This program is **experimental** and its interface is subject to change. + > **Warning** + > This program is **experimental** and its interface is subject to change. + + # Name + + `${command}` - ${def.description} + + # Synopsis + + ${showSynopsis { inherit command; args = def.args; }} + '' - + "# Name\n\n" - + "`${command}` - ${def.description}\n\n" - + "# Synopsis\n\n" - + showSynopsis { inherit command; args = def.args; } + (if def.commands or {} != {} then let @@ -24,8 +30,10 @@ let + "[`${command} ${name}`](./${appendName filename name}.md)" + " - ${cmds.${name}.description}\n") (attrNames cmds)); - in - "where *subcommand* is one of the following:\n\n" + in '' + where *subcommand* is one of the following: + + '' # FIXME: group by category + (if length categories > 1 then @@ -76,7 +84,7 @@ let showSynopsis = { command, args }: "`${command}` [*option*...] ${concatStringsSep " " - (map (arg: "*${arg.label}*" + (if arg ? arity then "" else "...")) args)}\n\n"; + (map (arg: "*${arg.label}*" + (if arg ? arity then "" else "...")) args)}"; processCommand = { command, def, filename }: [ { name = filename + ".md"; value = showCommand { inherit command def filename; }; inherit command; } ]