0 | module System.Term
 1 |
 2 | %default total
 3 |
 4 | libterm : String -> String
 5 | libterm s = "C:" ++ s ++ ", libidris2_support, idris_term.h"
 6 |
 7 | %foreign libterm "idris2_setupTerm"
 8 |          "node:lambda:()=>undefined"
 9 | prim__setupTerm : PrimIO ()
10 |
11 | %foreign libterm "idris2_getTermCols"
12 |          "node:lambda:()=>(process.stdout.columns ? BigInt(process.stdout.columns) : 0)"
13 | prim__getTermCols : PrimIO Int
14 |
15 | %foreign libterm "idris2_getTermLines"
16 |          "node:lambda:()=>(process.stdout.rows ? BigInt(process.stdout.rows) : 0)"
17 | prim__getTermLines : PrimIO Int
18 |
19 | export
20 | setupTerm : IO ()
21 | setupTerm = primIO prim__setupTerm
22 |
23 | ||| Get the number of columns in the terminal associated
24 | ||| with stdout. If stdout is not a TTY terminal or for
25 | ||| some other reason the width fails to be read you will
26 | ||| get 0.
27 | export
28 | getTermCols : IO Int
29 | getTermCols = primIO prim__getTermCols
30 |
31 | ||| Get the number of rows in the terminal associated
32 | ||| with stdout. If stdout is not a TTY terminal or for
33 | ||| some other reason the height fails to be read you
34 | ||| will get 0.
35 | export
36 | getTermLines : IO Int
37 | getTermLines = primIO prim__getTermLines
38 |