commit df96999fba9553b6c85770754ad14a11ed30fdeb
parent fac35aba35683be154b39290d4862d058f6cd9bf
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date: Fri, 8 Sep 2023 12:48:33 -0300
lib/util: Fix yn
Diffstat:
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/utils.lua b/lib/utils.lua
@@ -9,13 +9,23 @@ function die(err, msg)
end
function yn(prompt)
- meaning = {Y = true, y = true, n = false, N = false}
+ local meaning = {
+ Y = true,
+ y = true,
+ yes = true,
+ Yes = true,
+ n = false,
+ N = false,
+ No = false,
+ no = false
+ }
+ local ans
while meaning[ans] == nil do
io.write(prompt)
io.flush() -- For some reason, prompt doesn't show up without this
- ans = io.read(1)
+ ans = io.read()
end
- return ans
+ return meaning[ans]
end
function decodewith(decoder, fn)