mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2024-11-16 06:28:32 -06:00
again again again
This commit is contained in:
parent
fef319ee52
commit
d0d1297f23
1 changed files with 23 additions and 23 deletions
|
@ -88,7 +88,6 @@ func render*(cli: HwylCliHelp, f: HwylFlagHelp): string =
|
||||||
result.add "[" & cli.styles.flagDesc & "]"
|
result.add "[" & cli.styles.flagDesc & "]"
|
||||||
result.add f.description
|
result.add f.description
|
||||||
result.add "[/" & cli.styles.flagDesc & "]"
|
result.add "[/" & cli.styles.flagDesc & "]"
|
||||||
result.add "\n"
|
|
||||||
|
|
||||||
func render*(cli: HwylCliHelp, subcmd: HwylSubCmdHelp): string =
|
func render*(cli: HwylCliHelp, subcmd: HwylSubCmdHelp): string =
|
||||||
result.add " "
|
result.add " "
|
||||||
|
@ -97,38 +96,39 @@ func render*(cli: HwylCliHelp, subcmd: HwylSubCmdHelp): string =
|
||||||
result.add "[/]"
|
result.add "[/]"
|
||||||
result.add " "
|
result.add " "
|
||||||
result.add subcmd.desc.alignLeft(cli.subcmdDescLen)
|
result.add subcmd.desc.alignLeft(cli.subcmdDescLen)
|
||||||
result.add "\n"
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: split this into separate procs to make overriding more fluid
|
# TODO: split this into separate procs to make overriding more fluid
|
||||||
func render*(cli: HwylCliHelp): string =
|
func render*(cli: HwylCliHelp): string =
|
||||||
|
var parts: seq[string]
|
||||||
|
|
||||||
if cli.header != "":
|
if cli.header != "":
|
||||||
result.add cli.header
|
parts.add cli.header
|
||||||
result.add "\n\n"
|
|
||||||
if cli.usage != "":
|
if cli.usage != "":
|
||||||
result.add "[" & cli.styles.header & "]"
|
var part: string
|
||||||
result.add "usage[/]:\n"
|
part.add "[" & cli.styles.header & "]"
|
||||||
result.add indent(cli.usage, 2 )
|
part.add "usage[/]:\n"
|
||||||
result.add "\n"
|
part.add indent(cli.usage, 2 )
|
||||||
|
parts.add part
|
||||||
if cli.description != "":
|
if cli.description != "":
|
||||||
result.add "\n"
|
parts.add cli.description & "\n"
|
||||||
result.add cli.description
|
|
||||||
result.add "\n"
|
|
||||||
if cli.subcmds.len > 0:
|
if cli.subcmds.len > 0:
|
||||||
result.add "\n"
|
var part: string
|
||||||
result.add "[" & cli.styles.header & "]"
|
part.add "[" & cli.styles.header & "]"
|
||||||
result.add "subcommands[/]:\n"
|
part.add "subcommands[/]:\n"
|
||||||
for s in cli.subcmds:
|
part.add cli.subcmds.mapIt(render(cli,it)).join("\n")
|
||||||
result.add cli.render(s)
|
parts.add part
|
||||||
result.add "\n"
|
|
||||||
if cli.flags.len > 0:
|
if cli.flags.len > 0:
|
||||||
result.add "[" & cli.styles.header & "]"
|
var part: string
|
||||||
result.add "flags[/]:\n"
|
part.add "[" & cli.styles.header & "]"
|
||||||
for f in cli.flags:
|
part.add "flags[/]:\n"
|
||||||
result.add render(cli,f)
|
part.add cli.flags.mapIt(render(cli, it)).join("\n")
|
||||||
|
parts.add part
|
||||||
if cli.footer != "":
|
if cli.footer != "":
|
||||||
result.add "\n"
|
parts.add cli.footer
|
||||||
result.add cli.footer
|
|
||||||
|
parts.join("\n\n")
|
||||||
|
|
||||||
|
|
||||||
proc bb*(cli: HwylCliHelp): BbString =
|
proc bb*(cli: HwylCliHelp): BbString =
|
||||||
result = bb(render(cli))
|
result = bb(render(cli))
|
||||||
|
|
Loading…
Reference in a new issue