Software /
code /
prosody
Annotate
teal-src/util/human/io.d.tl @ 12701:8e402a2ae1b8
util.jwt: Overhaul of tests to use declarative approach
Now we can consistently apply the same tests to every algorithm, instead of
duplicating code.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 02 Jul 2022 14:22:20 +0100 |
parent | 12613:a27870dcaf24 |
rev | line source |
---|---|
12613
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local record lib |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 getchar : function (n : integer) : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 getline : function () : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 getpass : function () : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 show_yesno : function (prompt : string) : boolean |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 read_password : function () : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 show_prompt : function (prompt : string) : boolean |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 printf : function (fmt : string, ... : any) |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 padleft : function (s : string, width : integer) : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 padright : function (s : string, width : integer) : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 -- {K:V} vs T ? |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 record tablerow<K,V> |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 width : integer | string -- generate an 1..100 % enum? |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 title : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 mapper : function (V, {K:V}) : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 key : K |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 enum alignments |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 "left" |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 "right" |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 end |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 align : alignments |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 end |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 type getrow = function<K,V> ({ K : V }) : string |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 table : function<K,V> ({ tablerow<K,V> }, width : integer) : getrow<K,V> |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 end |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 |
a27870dcaf24
util.human.io: Add Teal interface definition
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 return lib |