aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-10 15:12:03 +0100
committerKim Alvefur <zash@zash.se>2021-11-10 15:12:03 +0100
commit238c64e233938970224ad691831336cbfa08cdfd (patch)
tree6db215f2a1c429a6016cf0f9878aa7a269a637bb
parent523d844c789556f259244c2139009eff924e91ae (diff)
downloadprosody-238c64e233938970224ad691831336cbfa08cdfd.tar.gz
prosody-238c64e233938970224ad691831336cbfa08cdfd.zip
util.human.io: Add Teal interface definition
-rw-r--r--teal-src/util/human/io.d.tl28
1 files changed, 28 insertions, 0 deletions
diff --git a/teal-src/util/human/io.d.tl b/teal-src/util/human/io.d.tl
new file mode 100644
index 00000000..e4f64cd1
--- /dev/null
+++ b/teal-src/util/human/io.d.tl
@@ -0,0 +1,28 @@
+local record lib
+ getchar : function (n : integer) : string
+ getline : function () : string
+ getpass : function () : string
+ show_yesno : function (prompt : string) : boolean
+ read_password : function () : string
+ show_prompt : function (prompt : string) : boolean
+ printf : function (fmt : string, ... : any)
+ padleft : function (s : string, width : integer) : string
+ padright : function (s : string, width : integer) : string
+
+ -- {K:V} vs T ?
+ record tablerow<K,V>
+ width : integer | string -- generate an 1..100 % enum?
+ title : string
+ mapper : function (V, {K:V}) : string
+ key : K
+ enum alignments
+ "left"
+ "right"
+ end
+ align : alignments
+ end
+ type getrow = function<K,V> ({ K : V }) : string
+ table : function<K,V> ({ tablerow<K,V> }, width : integer) : getrow<K,V>
+end
+
+return lib