use indented strings where appropriate

This commit is contained in:
Valentin Gagarin 2022-08-26 17:08:20 +02:00
parent 82ef3c470b
commit 6b56bb4a79

View file

@ -8,12 +8,18 @@ let
showCommand = showCommand =
{ command, def, filename }: { 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 {} != {} + (if def.commands or {} != {}
then then
let let
@ -24,8 +30,10 @@ let
+ "[`${command} ${name}`](./${appendName filename name}.md)" + "[`${command} ${name}`](./${appendName filename name}.md)"
+ " - ${cmds.${name}.description}\n") + " - ${cmds.${name}.description}\n")
(attrNames cmds)); (attrNames cmds));
in in ''
"where *subcommand* is one of the following:\n\n" where *subcommand* is one of the following:
''
# FIXME: group by category # FIXME: group by category
+ (if length categories > 1 + (if length categories > 1
then then
@ -76,7 +84,7 @@ let
showSynopsis = showSynopsis =
{ command, args }: { command, args }:
"`${command}` [*option*...] ${concatStringsSep " " "`${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 }: processCommand = { command, def, filename }:
[ { name = filename + ".md"; value = showCommand { inherit command def filename; }; inherit command; } ] [ { name = filename + ".md"; value = showCommand { inherit command def filename; }; inherit command; } ]