aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/prosody/util/human
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-03-23 13:36:52 +0100
committerKim Alvefur <zash@zash.se>2023-03-23 13:36:52 +0100
commitf68336b96e0d843511bb1bd3fdac8bba2fe4573a (patch)
treea54111914e081293e50b846e7f0d9654e885c2ed /teal-src/prosody/util/human
parent738df041ac3965496e9247acc95d80f84d30b2b5 (diff)
downloadprosody-f68336b96e0d843511bb1bd3fdac8bba2fe4573a.tar.gz
prosody-f68336b96e0d843511bb1bd3fdac8bba2fe4573a.zip
teal: Move into prosody namespace
Diffstat (limited to 'teal-src/prosody/util/human')
-rw-r--r--teal-src/prosody/util/human/io.d.tl28
-rw-r--r--teal-src/prosody/util/human/units.d.tl8
2 files changed, 36 insertions, 0 deletions
diff --git a/teal-src/prosody/util/human/io.d.tl b/teal-src/prosody/util/human/io.d.tl
new file mode 100644
index 00000000..e4f64cd1
--- /dev/null
+++ b/teal-src/prosody/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
diff --git a/teal-src/prosody/util/human/units.d.tl b/teal-src/prosody/util/human/units.d.tl
new file mode 100644
index 00000000..3db17c3a
--- /dev/null
+++ b/teal-src/prosody/util/human/units.d.tl
@@ -0,0 +1,8 @@
+local lib = record
+ enum logbase
+ "b" -- 1024
+ end
+ adjust : function (number, string) : number, string
+ format : function (number, string, logbase) : string
+end
+return lib