mirror of
https://github.com/daylinmorgan/bbansi.git
synced 2024-11-22 01:10:44 -06:00
refactor: move debug to mainmodule
This commit is contained in:
parent
a5f7ca90cd
commit
f4594287d1
1 changed files with 14 additions and 7 deletions
|
@ -13,13 +13,6 @@ type
|
||||||
plain: string
|
plain: string
|
||||||
spans: seq[BbSpan]
|
spans: seq[BbSpan]
|
||||||
|
|
||||||
proc debug(bbs: BbString): string =
|
|
||||||
echo "bbString("
|
|
||||||
echo " raw: ", bbs.raw
|
|
||||||
echo " plain: ", bbs.plain
|
|
||||||
echo " spans: ", bbs.spans
|
|
||||||
echo ")"
|
|
||||||
|
|
||||||
proc `&`*(x: BbString, y: string): BbString =
|
proc `&`*(x: BbString, y: string): BbString =
|
||||||
result = x
|
result = x
|
||||||
result.raw &= y
|
result.raw &= y
|
||||||
|
@ -129,6 +122,11 @@ proc `&`*(x: BbString, y: BbString): Bbstring =
|
||||||
# there is probably a more efficient way to do this
|
# there is probably a more efficient way to do this
|
||||||
bb(x.raw & y.raw)
|
bb(x.raw & y.raw)
|
||||||
|
|
||||||
|
proc bbEcho*(args: varargs[string, `$`]) {.sideEffect.} =
|
||||||
|
for x in args:
|
||||||
|
stdout.write(x.bb)
|
||||||
|
stdout.write('\n')
|
||||||
|
stdout.flushFile
|
||||||
|
|
||||||
# ---- cli
|
# ---- cli
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
|
@ -154,6 +152,15 @@ flags:
|
||||||
]:
|
]:
|
||||||
&"[yellow]-{s}[/] [green]--{l.alignLeft(longOptPad)}[/] {d}").join("\n ")
|
&"[yellow]-{s}[/] [green]--{l.alignLeft(longOptPad)}[/] {d}").join("\n ")
|
||||||
))
|
))
|
||||||
|
|
||||||
|
proc debug(bbs: BbString): string =
|
||||||
|
echo "bbString("
|
||||||
|
echo " raw: ", bbs.raw
|
||||||
|
echo " plain: ", bbs.plain
|
||||||
|
echo " spans: ", bbs.spans
|
||||||
|
echo " escaped: ", escape($bbs)
|
||||||
|
echo ")"
|
||||||
|
|
||||||
proc writeHelp() =
|
proc writeHelp() =
|
||||||
echo help
|
echo help
|
||||||
quit(QuitSuccess)
|
quit(QuitSuccess)
|
||||||
|
|
Loading…
Reference in a new issue