refactor: don't process help string by default

This commit is contained in:
Daylin Morgan 2023-09-20 15:40:55 -05:00
parent 190cf82e6e
commit 5d5b459c95
Signed by: daylin
GPG Key ID: C1E52E7DD81DF79F
1 changed files with 6 additions and 6 deletions

View File

@ -141,7 +141,8 @@ when isMainModule:
import std/[parseopt, strformat, sugar]
const version = staticExec "git describe --tags --always --dirty=-dev"
const longOptPad = 8
let help = fmt"""
proc writeHelp() =
let help = fmt"""
[bold]bbansi[/] \[[green]args...[/]] [[[faint]-h|-v[/]]
[italic]usage[/]:
@ -160,6 +161,8 @@ flags:
]:
fmt"[yellow]-{s}[/] [green]--{l.alignLeft(longOptPad)}[/] {d}").join("\n ")
))
echo help
quit(QuitSuccess)
proc testCard =
for style in [
@ -182,9 +185,7 @@ flags:
echo " escaped: ", escape($bbs)
echo ")"
proc writeHelp() =
echo help
quit(QuitSuccess)
proc writeVersion() =
echo fmt"[yellow]bbansi version[/][red] ->[/] [bold]{version}[/]".bb
quit(QuitSuccess)
@ -212,8 +213,7 @@ flags:
of cmdArgument:
strArgs.add key
if strArgs.len == 0:
echo help
quit(QuitSuccess)
writeHelp()
for arg in strArgs:
let styled =
if style != "":