tty.bend
bend-kit-tty@0.1.0.1 · 35 lines · 7 definitions
1
2import Base
3import bend-kit-tty@0.1.0.1/text.bend as Text
4
5
6def stdout_tty() -> IO(Bool):
7 import "./effs/tty.c"
8 import "./effs/tty.js"
9
10
11def size() -> IO(Maybe<&1, U32 & U32>):
12 import "./effs/tty.c"
13 import "./effs/tty.js"
14
15
16def color_enabled() -> IO(Bool):
17 import "./effs/tty.c"
18 import "./effs/tty.js"
19
20
21def style(enabled: Bool, code: U32, text: String) -> String:
22 Text.style(enabled, code, text)
23
24def auto_style(code: U32, text: String) -> IO(String):
25 do IO<String>:
26 enabled : Bool <- color_enabled()
27 return style(enabled, code, text)
28
29
30def width(text: String) -> U32:
31 Text.width(text)
32
33
34def pad_right(text: String, cols: U32) -> String:
35 Text.pad_right(text, cols)