blob: d13fcf91e1c0293baee50cb76e4b5da30b83779f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{.used.}
template eprint*(s: varargs[string, `$`]) = {.cast(noSideEffect).}:
var a = false
for x in s:
if not a:
a = true
else:
stderr.write(' ')
stderr.write(x)
stderr.write('\n')
template eecho*(s: varargs[string, `$`]) = {.cast(noSideEffect).}:
var a = false
var o = ""
for x in s:
if not a:
a = true
else:
o &= ' '
o &= x
echo o
template print*(s: varargs[string, `$`]) =
for x in s:
stdout.write(x)
template printesc*(s: string) =
for r in s.runes:
if r.isControlChar():
stdout.write(('^' & $($r)[0].getControlLetter())
.ansiFgColor(fgBlue).ansiStyle(styleBright).ansiReset())
else:
stdout.write($r)
|